PM2 is an advanced process manager for running Node.js applications. That provides an easier option to automate a Node.js application. We can quickly do the start, stop, or other operations on applications. Many of the Node.js applications use “npm start” to run. In this quick how-to guide, we will help you to run “npm start” using pm2.

Assuming that you already have Node.js installed on your system. If you haven’t already, visit our tutorial to install Node.js using nvm.

  1. Installing PM2: Make sure you have installed PM2 globally on your machine with this command:
    npm install pm2 --location=global 
    

    After installing pm2, run “pm2 startup” once to configure auto-start pm2 during system reboot.

  2. Start npm: PM2 also supports to run npm start:
    pm2 start npm -- start 
    

    Use the --name option to assign a name to the PM2 process.

    pm2 start npm --name "my_app" -- start 
    
  3. List all service running with pm2
    pm2 list 
    

Hopefully, this article helped you to run the NPM application using the pm2 process manager.

See the screenshots of running npm start with pm2.

Running “npm start” with PM2 General Articles nodejs npm pm2

Running “npm start” with PM2 General Articles nodejs npm pm2