PM2 is a process manager for Node.js applications. It is helpful for running Node.js application on production environment. PM2 keep an eye on your application and restart it automatically in case of application crashes. PM2 also have an build in load balancer for make easier to scale applications.
In this tutorial you will learn to install Angaular CLI on your Linux system. Then create a sample Angular application. Also run your Angular application with PM2 on a Linux system.
Prerequisites
To use this tutorial, you must have shell to your server with sudo privileged account. Login to your server and open shell to continue work.
Step 1 – Install Node.js
The systems doesn’t have Node.js installed, can use below commands to install Node.js on their system suing NVM (Node version manager).
Run below command to install NVM on your system:
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
Then install any Nodejs version recommended for your application. Below command will install Node.js 12 on your system. You can change any version number instead of 12.
nvm install 12
Once the installation completed successfully. View the installed version of Node.js and npm by running the following commands.
node -v
v12.18.2
npm -v
6.14.5
Step 2 – Install Angular CLI with PM2
Angular CLI is the command line utility to create, build and run Angular applications. It is available as Node module to install on any system have npm installed.
Run the below command to install latest Angular cli application on your system:
npm install -g @angular/cli
Also, install pm2 application by running the following command:
npm install -g pm2
At this stage your system is create to create and run angular application.
#angularjs #angular #node #pm2