generator-webapp
generator-webapp copied to clipboard
Deploying to Heroku using Node.js not working?
Been attempting to get a web app running on Heroku using NodeJS. Used the provided recipe for setting it up: node-heroku . However, the app builds correctly on Heroku, but when visiting the app page, it returns an application error. Tested it with the configuration that I used and base configuration of all config options enabled(BDD & TDD). Still same issue. Is it an issue with Heroku or the generator?
If more information is required, link to repository can be found here: github.com/Meadowcottage/KaplanSays. The dist files was made in the order provided by the deploying to heroku using node.js recipe.
I have checked the Heroku logs and the crash log returns the following:
2017-02-21T22:12:25.394968+00:00 heroku[web.1]: Starting process with command `npm start`
2017-02-21T22:12:28.366684+00:00 heroku[web.1]: Process exited with status 1
2017-02-21T22:12:28.384951+00:00 heroku[web.1]: State changed from starting to crashed
2017-02-21T22:12:28.282442+00:00 app[web.1]: npm ERR! Linux 3.13.0-105-generic
2017-02-21T22:12:28.283226+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2017-02-21T22:12:28.283500+00:00 app[web.1]: npm ERR! node v7.5.0
2017-02-21T22:12:28.283773+00:00 app[web.1]: npm ERR! npm v4.1.2
2017-02-21T22:12:28.285052+00:00 app[web.1]:
2017-02-21T22:12:28.286543+00:00 app[web.1]: npm ERR! missing script: start
2017-02-21T22:12:28.286758+00:00 app[web.1]: npm ERR!
2017-02-21T22:12:28.286908+00:00 app[web.1]: npm ERR! If you need help, you may report this error at:
2017-02-21T22:12:28.287072+00:00 app[web.1]: npm ERR! <https://github.com/npm/npm/issues>
2017-02-21T22:12:28.298997+00:00 app[web.1]:
2017-02-21T22:12:28.299253+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2017-02-21T22:12:28.299393+00:00 app[web.1]: npm ERR! /app/npm-debug.log
I double checked the dist/package.json
and a start script is present.
Any ideas why this error may be occurring?
I don't use Heroku, but are you sure that package.json
got deployed to Heroku? Is there any way to see that?
I have been looking into this more and I found the issue. The Heroku app by default tries to build from the root directory. Makes sense about the no script error now 😂. Need to find a way to point Heroku to build from a sub directory or set the build directory. If I do i'll make a PR.
If you see the very end of that recipe, it says that you should deploy only dist
, so I'm guessing that should be your root. Is that possible to do?
I don't have a huge total use time with Heroku, but from what I have been working out is that you can instead point it to a branch to deploy from. So best bet is to create a deployment branch and point Heroku to that branch to build from.
Yeah. In any case it appears that modifications to the recipe should be made. If you'd like to submit a PR once you get it working, that would be great. The simpler, the better. 😉