简体   繁体   English

启动使用带有pm2的交叉环境的nodejs应用程序

[英]Start nodejs app that use cross-env with pm2

I'm trying to start my nodejs app, the default cmd is the following : 我正在尝试启动我的nodejs应用程序,默认cmd如下:

pm2 start app.js

I can't do that because I use cross-env and the script as below: 我不能这样做,因为我使用cross-env和脚本如下:

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

So npm run start will launch the script above. 所以npm run start将启动上面的脚本。

How can I serve my app using pm2 and the script above ? 如何使用pm2和上面的脚本来提供我的应用程序?

You can use: 您可以使用:

pm2 start npm -- start

or 要么

pm2 start npm --name CrossApp -- run start

Hope this helps 希望这可以帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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