Reputation: 5227
package.json
{
//Other stuff here
"scripts": {
"prestart": "./scripts/prestart.sh",
"start": "./scripts/start.sh"
}
}
prestart.sh
#!/usr/bin/env bash
set -ex
webpack
start.sh
#!/usr/bin/env bash
set -ex
http-server -p $PORT
Procfile
web: npm start
When I push to heroku, I get an application error. So I ran a heroku run bash
, and noticed that the prestart and start scripts were not run at all (running prestart calls webpack - which will create a generated folder with js file).
Any ideas to solve this ?
EDIT:
Webpack now works when i put it in postinstall, instead of prestart.
http-server does not run though. When I run heroku logs --tail
, I do not see any output from http-server.
Output of heroku logs --tail
2015-06-23T18:05:55.628044+00:00 heroku[slug-compiler]: Slug compilation started
2015-06-23T18:05:55.628049+00:00 heroku[slug-compiler]: Slug compilation finished
2015-06-23T18:05:55.582057+00:00 heroku[api]: Deploy ** by ***
2015-06-23T18:05:55.582057+00:00 heroku[api]: Release v14 created by ****
2015-06-23T18:07:49.114534+00:00 heroku[api]: Starting process with command `bash` by ****
2015-06-23T18:07:54.748361+00:00 heroku[run.8851]: Starting process with command `bash`
2015-06-23T18:07:54.701235+00:00 heroku[run.8851]: Awaiting client
2015-06-23T18:07:54.808283+00:00 heroku[run.8851]: State changed from starting to up
2015-06-23T18:22:20.007391+00:00 heroku[run.8851]: State changed from up to complete
2015-06-23T18:22:19.997342+00:00 heroku[run.8851]: Process exited with status 0
Upvotes: 1
Views: 11030
Reputation: 13799
If you're using webpack
to build your app, you should put it into the postinstall
script (not prestart
) so it runs on build.
npm start
should be executing regularly, when Heroku tries to start your app. To see what's happening instead, check heroku logs --tail
.
Upvotes: 6