7

I'm trying to start my nodejs app, the default cmd is the following :

pm2 start app.js

I can't do that because I use cross-env and the script as below:

"start": cross-env DOTENV_FILE=.env node build/app.js

So npm run start will launch the script above.

How can I serve my app using pm2 and the script above ?

An-droid
  • 6,433
  • 9
  • 48
  • 93
  • Possible duplicate of [Can pm2 run an 'npm start' script](https://stackoverflow.com/questions/31579509/can-pm2-run-an-npm-start-script) – David Oct 04 '17 at 09:39

1 Answers1

9

You can use:

pm2 start npm -- start

or

pm2 start npm --name CrossApp -- run start

Hope this helps

Siddharth Srivastva
  • 965
  • 2
  • 13
  • 34