PM2 Heroku Deployment fails to launch application

I am following the directions here: http://pm2.keymetrics.io/docs/usage/use-pm2-with-cloud-providers/

Attempting to push a test app to Heroku and getting the error message:

[PM2] Spawning PM2 daemon with pm2_home=/app/.pm2
 2017-12-04T22:35:51.928946+00:00 app[web.1]: [PM2] PM2 Successfully daemonized
 2017-12-04T22:35:51.955730+00:00 app[web.1]: [PM2][ERROR] script not found : /app/dist/server.js
 2017-12-04T22:35:51.955882+00:00 app[web.1]: script not found : /app/dist/server.js

My package.json:

"scripts": {
  "preinstall": "npm install pm2 -g",
  "start": "pm2 start ./dist/server.js -i 1 --attach"
}

This is the folder structure:
enter image description here

I am able to launch this locally by npm start. Any ideas or clues why this is happening?

Answer

Ensure that your dist folder is being pushed to git. Check the contents of .gitignore.

Leave a Reply

Your email address will not be published. Required fields are marked *