thefailtheory thefailtheory - 8 months ago 36
Javascript Question

How to deploy a nodejs app to heroku with github

i want to deploy this application i am developping on my channel
to heroku but i am facing an error

the application is basic it will try to solve a problem on freelancing in the cloud i use everyday

here is the log :

2016-11-22T16:20:34.454131+00:00 app[web.1]: npm ERR! code ELIFECYCLE

2016-11-22T16:20:34.454297+00:00 app[web.1]: npm ERR! neofreelance@1.0.0 start: `node app.js`

2016-11-22T16:20:34.454450+00:00 app[web.1]: npm ERR! Exit status 1

2016-11-22T16:20:34.454616+00:00 app[web.1]: npm ERR!

2016-11-22T16:20:34.454772+00:00 app[web.1]: npm ERR! Failed at the neofreelance@1.0.0 start script 'node app.js'.

2016-11-22T16:20:34.454931+00:00 app[web.1]: npm ERR! Make sure you have the latest version of node.js and npm installed.

2016-11-22T16:20:34.455081+00:00 app[web.1]: npm ERR! If you do, this is most likely a problem with the neofreelance package,

2016-11-22T16:20:34.455232+00:00 app[web.1]: npm ERR! not with npm itself.

2016-11-22T16:20:34.455378+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:

2016-11-22T16:20:34.455537+00:00 app[web.1]: npm ERR! node app.js

2016-11-22T16:20:34.455684+00:00 app[web.1]: npm ERR! You can get information on how to open an issue for this project with:

2016-11-22T16:20:34.455833+00:00 app[web.1]: npm ERR! npm bugs neofreelance

2016-11-22T16:20:34.456007+00:00 app[web.1]: npm ERR! Or if that isn't available, you can get their info via:

2016-11-22T16:20:34.456156+00:00 app[web.1]: npm ERR! npm owner ls neofreelance

2016-11-22T16:20:34.456302+00:00 app[web.1]: npm ERR! There is likely additional logging output above.

2016-11-22T16:20:34.459887+00:00 app[web.1]:

2016-11-22T16:20:34.460174+00:00 app[web.1]: npm ERR! Please include the following file with any support request:

2016-11-22T16:20:34.460356+00:00 app[web.1]: npm ERR! /app/npm-debug.log

Answer Source

That is because Block-scoped declarations (let, const) are not yet supported in the Node version Heroku is using outside of strict mode.

So two options:

  • Add "use strict"; at the beginning of your file
  • Use var and not let.