Question

how to run pm2 in app plattforms using nodejs api

I have a simple nodejs API to test on the app platform. To keep it running I’m using pm2 and works as expected on localhost. Currently, I’m using something like “pm2 start build/index.js” to start it. After building and deploying I’m getting the below error:

https://ibb.co/gFBzZMp https://ibb.co/yd0cQzV

Now, I was reading about use pm2-runtime instead of pm2 but I don’t know how can use it on the app platform. Does anybody know how can keep alive my API REST using pm2?


Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

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.

Hello,

First Give the below command as the Build Command in your App settings

npm install pm2 -g

and then you can try the below command as your Run time command.

pm2-runtime start index.js