xxxxxxxxxx
PM2 now supports npm start:
To assign a name to the PM2 process, use the --name option:
pm2 start npm --name "app name" -- start
xxxxxxxxxx
pm2.start({
name: `App`,
script: `index.js`,
out_file: `app.strout.log`,
error_file: `app.strerr.log`
}, function (err, apps) {
if (err) {
console.log(err)
}
console.log("done")
})
xxxxxxxxxx
pm2 start npm --name "server" -- start
//server is npm script in package.json
// "scripts": {
// "test": "echo \"Error: no test specified\" && exit 1",
// "start": "node backend/server",
// "server": "nodemon backend/server",
// "client": "npm start --prefix frontend",
// }