How to Install PM2 and get Output even after Restart PC...
Swaraj Jadhav
Developer | Educator | Innovator Contact : [email protected] | +918421946505
Follow below steps :-
1. To getting start with pm2 you must have npm in Machine, download node from browser.
2. Open cmd with Administrator rights.
3. Run command in cmd, npm --version
4. Run command in cmd, npm install pm2 -g
5. Run command in cmd, npm i pm2-windows-service -g
6. Run command in cmd, npm install -g npm-check-updates
7. Now go into 'C:\NodeJS\npm\node_modules\pm2-windows-service' or search for pm2-windows-service folder and open cmd and Run command, ncu inquirer -u
8. Now Run command, pm2-service-install -n PM2_STARTUP_SCRIPT
9. Setup is done now check it working or not, Run command in your file location cmd, pm2 start yourApp.js
10. Now check if app added or not for run command, pm2 list
11. Now check output of file for run command, pm2 logs
12. If you can see your Output then file is working fine.
13. Now check if even restart of pc can we get output or not !
14. Now restart pc and open cmd with administrator rights and run command, pm2 list , if you can see your file name there then your setup is done.
15. If not then you have to install more packages..
16. Search for pm2-installer in github and download that file. and run command, npm run setup, if you found error then cut that process and run, npm run configure and then npm run setup
17. Now for checking do again No. 14 step
18. If not then Run command, npm i pm2-windows-startup
19. Now go into Services ( search in pc ) in PM or PM2 check properties, account, logon, do local system account then stop that service and start.
20. Now most imp do, pm2 save
21. Now do No. 14 step again. This time it'll work.