Preparing NodeJS and PM2
Table of Contents
Install Node Version Manager
As www-data
install NVM by using the /microcloud/scripts/nvm_install.sh
Install NodeJS
We will use NVM to install the latest Node LTS version:
source ~/.bash_profile; nvm install --lts
Install PM2
npm install -g pm2
Once the installation has completed, switch to the root
user by using the su
command.
As root
, run the following command:
su www-data -c "source ~/.bash_profile; pm2 startup upstart 2>&1" | grep -Eo '(env.*)'
Paste the output of the command in order to install the PM2 init script - PM2 will now start on boot.
Upgrading NodeJS version/PM2
! If you upgrade the NodeJS version, you MUST re-run the pm2 install and update as below:
npm install -g pm2@latest && pm2 update
Next Steps:
Please see below for setup guides for the most common PWA apps: