Behnam Azimi
Behnam Azimi

Reputation: 2488

Run node server with PM2

How could I run node server.js -p by pm2?

Scripts of my package.json is like below,

 "scripts": {
    "dev": "node server.js",
    "start": "node server.js -p"
  },

When I execute npm start everything work truly. But I want to run this command with pm2.

To do it when I run pm2 start npm -- start, the process will add to the list of the pm2 but my app not run!

Upvotes: 1

Views: 17746

Answers (1)

Simone Sanfratello
Simone Sanfratello

Reputation: 1620

the correct command is

pm2 start server.js

or if you want to pass -p to your app and a name

pm2 start server.js --name "my-server" -- -p

Upvotes: 15

Related Questions