是否有一种方法让pm2运行npm启动脚本,或者你只需要运行pm2 start app.js
所以在发展中
npm start
然后在使用pm2的生产中,你会运行这样的程序
pm2 start 'npm start'
有一种等效的方法可以永远做到这一点:
forever start -c "npm start" ./
是否有一种方法让pm2运行npm启动脚本,或者你只需要运行pm2 start app.js
所以在发展中
npm start
然后在使用pm2的生产中,你会运行这样的程序
pm2 start 'npm start'
有一种等效的方法可以永远做到这一点:
forever start -c "npm start" ./
当前回答
使用npm运行
Pm2启动NPM——name "{app_name}"——run {script_name}
其他回答
我需要在我的应用程序pm2中运行一个特定的npm脚本(对于每个env) 在我的例子中,是当我创建一个登台/测试服务时
对我有用的命令(参数必须这样转发):
pm2 start npm --name "my-app-name" -- run "npm:script"
例子:
pm2 start npm --name "myApp" -- run "start:test"
pm2 start npm --name "myApp" -- run "start:staging"
pm2 start npm --name "myApp" -- run "start:production"
希望有帮助
PM2现在支持npm start:
pm2 start npm -- start
要给PM2进程分配一个名称,使用——name选项:
pm2 start npm --name "app name" -- start
请参见启用集群:
pm2 start npm --name "AppName" -i 0 -- run start
你怎么看?
用npm start方法运行PM2并给它命名,运行这个, Pm2启动NPM——命名"your_app_name"——启动
通过为日志传递date-format来运行它, 启动npm——name" your_name"——log-date-format 'DD-MM HH:mm:ss。SSS’——开始
pm2 start ./bin/www
可以运行
如果你想部署多个服务器 你可以这样做。而不是pm2启动NPM——启动