Thursday 4 May 2017

Starting process with command `npm start` in Heroku

I've found following error message when I deployed my app to heroku. Heroku gave me following error message

2017-05-05T04:01:57.462384+00:00 heroku[web.1]: Starting process with command `npm start`
2017-05-05T04:02:01.390032+00:00 app[web.1]: 
2017-05-05T04:02:01.481034+00:00 app[web.1]:     at Function.Module._load (module.js:418:25)
2017-05-05T04:02:01.390047+00:00 app[web.1]: > pwa-courses@1.0.0 start /app
2017-05-05T04:02:01.481034+00:00 app[web.1]:     at Module.require (module.js:498:17)
2017-05-05T04:02:01.390048+00:00 app[web.1]: > node server.js
2017-05-05T04:02:01.481034+00:00 app[web.1]:     at require (internal/module.js:20:19)
2017-05-05T04:02:01.390049+00:00 app[web.1]: 
2017-05-05T04:02:01.481035+00:00 app[web.1]:     at Object.<anonymous> (/app/server.js:1:77)
2017-05-05T04:02:01.481027+00:00 app[web.1]: module.js:472
2017-05-05T04:02:01.481035+00:00 app[web.1]:     at Module._compile (module.js:571:32)
2017-05-05T04:02:01.481031+00:00 app[web.1]:     throw err;
2017-05-05T04:02:01.481036+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:580:10)
2017-05-05T04:02:01.481031+00:00 app[web.1]:     ^
2017-05-05T04:02:01.481036+00:00 app[web.1]:     at Module.load (module.js:488:32)
2017-05-05T04:02:01.481032+00:00 app[web.1]: 
2017-05-05T04:02:01.481036+00:00 app[web.1]:     at tryModuleLoad (module.js:447:12)
2017-05-05T04:02:01.481033+00:00 app[web.1]: Error: Cannot find module 'express'
2017-05-05T04:02:01.481033+00:00 app[web.1]:     at Function.Module._resolveFilename (module.js:470:15)
2017-05-05T04:02:01.481037+00:00 app[web.1]:     at Function.Module._load (module.js:439:3)
2017-05-05T04:02:01.495848+00:00 app[web.1]: npm ERR! errno 1
2017-05-05T04:02:01.495852+00:00 app[web.1]: npm ERR! pwa-courses@1.0.0 start: `node server.js`
2017-05-05T04:02:01.495897+00:00 app[web.1]: npm ERR! Exit status 1
2017-05-05T04:02:01.495601+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2017-05-05T04:02:01.496006+00:00 app[web.1]: npm ERR! 
2017-05-05T04:02:01.496080+00:00 app[web.1]: npm ERR! Failed at the pwa-courses@1.0.0 start script 'node server.js'.
2017-05-05T04:02:01.496163+00:00 app[web.1]: npm ERR! Make sure you have the latest version of node.js and npm installed.
2017-05-05T04:02:01.496303+00:00 app[web.1]: npm ERR! If you do, this is most likely a problem with the pwa-courses package,
2017-05-05T04:02:01.496305+00:00 app[web.1]: npm ERR! not with npm itself.
2017-05-05T04:02:01.496375+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2017-05-05T04:02:01.496492+00:00 app[web.1]: npm ERR! You can get information on how to open an issue for this project with:
2017-05-05T04:02:01.496583+00:00 app[web.1]: npm ERR!     npm bugs pwa-courses
2017-05-05T04:02:01.496662+00:00 app[web.1]: npm ERR! Or if that isn't available, you can get their info via:
2017-05-05T04:02:01.496736+00:00 app[web.1]: npm ERR!     npm owner ls pwa-courses
2017-05-05T04:02:01.496811+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2017-05-05T04:02:01.496417+00:00 app[web.1]: npm ERR!     node server.js

and I've used VueJS from https://github.com/vuejs/pwa and build for production already. And here is scripts for package.json.

  "scripts": {
    "dev": "node build/dev-server.js",
    "start": "node server.js",
    "build": "node build/build.js",
    "unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run",
    "e2e": "node test/e2e/runner.js",
    "test": "npm run unit && npm run e2e",
    "lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs"
  },

and server.js

var express = require('express');
var path = require('path');
var serveStatic = require('serve-static');
app = express();
app.use(serveStatic(path.join(__dirname, 'dist')));
var port = process.env.PORT || 5000;
app.listen(port);
console.log('server started ' + port);

I can run npm start in my local successfully but in heroku, got those error. Please help me I missed to add something.



via ppshein

No comments:

Post a Comment