Skip to content

Running “npm start” with PM2

Covers
Node.js, npm
Versions & support
About Node.js →

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.

How to run npm start using pm2
Running npm start with pm2

Rahul

Rahul Kumar is the founder and chief editor of TecAdmin.net. A Red Hat Certified Engineer (RHCE), he has worked in IT since 2009, with hands-on experience in Linux system administration, DevOps, web hosting, cloud platforms and automation. He started TecAdmin in 2013 to share practical, step-by-step guides, and leads its editorial work with one aim: making technical learning clear and useful for sysadmins, developers and beginners alike.

Leave a Reply

Your email address will not be published. Required fields are marked *


Back to top