0
I lifted the server with express
, but using a schematic for the webpack
because I found nothing related to browserify
, follows the code...
// server.js
var express = require('express');
var path = require('path');
var serveStatic = require('serve-static');
app = express();
app.use(serveStatic(__dirname + "/dist"));
var port = process.env.PORT || 5000;
app.listen(port);
console.log('server started '+ port);
everything is already configured correctly, but is appearing only...
Cannot GET /
Does anyone know how I can do it?
package json.
"scripts": {
"watchify": "watchify -vd -p browserify-hmr -e src/main.js -o dist/build.js",
"serve": "http-server -o -s -c 1 -a localhost",
"dev": "npm-run-all --parallel watchify serve",
"build": "cross-env NODE_ENV=production browserify -g envify src/main.js | uglifyjs -c warnings=false -m > dist/build.js",
"postinstall": "npm install express",
"start" : "node server.js"
},
With the command that’s in start
the server raises, but the application is not found.
Obs. to start it locally a npm run dev
which could not be performed in start
on Heroku.
How’s your
package.json
? Heroku logs can help, see if there’s anything unusual about him– BrTkCa
I added the relevant part of package.json, also tried to check the logs, but it shows me nothing.
– Felipe Duarte
You can show us the server.js pf Felipe?
– BrTkCa
@Lucascosta, is already in the question
– Felipe Duarte
Oh yes, I listened to the comment. Try to leave the start this way:
"start": "./node_modules/webpack/bin/webpack.js -p --progress && node server.js"
. And make sure the webpack dependencies are in package.json correctly tb– BrTkCa
Sorry, I had put the wrong package.json, I already edited it, I tested the above solution and it didn’t work...
– Felipe Duarte
Hi Felipe, you have this project on github or you can create a
.zip
so we can test?– Sergio
see if this tutorial serves https://medium.com/netscape/deploying-a-vue-js-2-x-app-to-heroku-in-5-steps-tutorial-a69845ace489
– HudsonPH