Closed bcooke closed 8 years ago
Hi there!
Make sure that your express application sets the port to: process.env.PORT
when in production, as Heroku puts the port as an environment variable.
Just closing this. Hopefully it worked out :-)
I had to tweak my package.json to the following for it to work in Heroku. Of course, I'm pretty sure babel-node isn't recommended for production, so perhaps an even better approach would be a pre-compile babel and then a pointer to the compiled version of the server.js.
"start": "./node_modules/.bin/babel-node server.js"
@christianalfoni - BTW: Your blog posts and repos on webpack have been instrumental for me in breaking down how it all this works. I'm using this as a starting point, but am adding a few tweaks like SEO and Falcor integration. Keep up the awesome work.
@jmlivingston Yes indeed, have to transpile server code to normal ES5 for production :-)
Glad it has been helpful, thanks for the feedback! :+1:
Hi Christian,
First off, awesome starting point for a Webpack app!
I've tried to follow your blog post with the current code to get it running on Heroku, but I can't get it to work. Are there differences between the steps you recommend there and the repo's current state? I see it was originally written last April.
Here's exactly what I've done:
When I deploy to Heroku, the app says it builds successfully. But when I run heroku open, I'm just hit with a Application Error. Here's what the logs say:
2015-10-18T06:15:44.281256+00:00 heroku[web.1]: Starting process with command
npm start
2015-10-18T06:15:46.529826+00:00 app[web.1]: 2015-10-18T06:15:46.529838+00:00 app[web.1]: > chalk-web-client@0.1.0 start /app 2015-10-18T06:15:46.529840+00:00 app[web.1]: > babel-node server 2015-10-18T06:15:46.529841+00:00 app[web.1]: 2015-10-18T06:16:44.564574+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch 2015-10-18T06:16:44.564574+00:00 heroku[web.1]: Stopping process with SIGKILL 2015-10-18T06:16:45.228070+00:00 heroku[web.1]: Process exited with status 137 2015-10-18T06:16:45.242940+00:00 heroku[web.1]: State changed from starting to crashedThanks!