简体   繁体   中英

Start nodejs app that use cross-env with pm2

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 ?

You can use:

pm2 start npm -- start

or

pm2 start npm --name CrossApp -- run start

Hope this helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM