lulliezy
lulliezy

Reputation: 2043

Using PM2 to run other npm scripts

In my package.json file I have two scripts, start and production, start script is for local development while production script is for deployment. Using npm i would just do npm run production but how do I do this with pm2

Upvotes: 7

Views: 12252

Answers (2)

lulliezy
lulliezy

Reputation: 2043

I got it, the command is pm2 start npm --name=app-name -- run production

Upvotes: 8

Farhan Tahir
Farhan Tahir

Reputation: 2134

Install pm2 globally using npm i -g pm2 and then use pm2' command as follow:

pm2 start npm -- production

Upvotes: 0

Related Questions