I was following the Getting started after deploying NodeJS guide provided after setting up a Node.js Droplet and trying to get my personal website deployed. While I was trying to schedule my app.js to pm2, I encountered the following error:
root@DropletProjName:~/danaimone.com# sudo -u nodejs pm2 start app.js [PM2][ERROR] Script not found: /root/danaimone.com/app.js
If I try to do a pm2 start app.js while logged in as root, without switching to the nodejs user, it adds fine. Unfortunately, this problem is interfering with deployment to the web since the nodejs user handles pm2 directly. I’m not sure if it’s because the folder is cloned on root and pm2 is not able to get the specific path. I tried an absolute path (/root/danaimone.com/app.js, /root/danaimone.com/app) to no success. I would appreciate any help y’all can provide on this!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
Click below to sign up and get $200 of credit to try our products over 60 days!