Questions tagged [pm2]

PM2 is a CLI process manager for Node.js applications with a built-in load balancer

pm2 is a process manager for Node apps with a built-in load-balancer.

pm2 is perfect when you need to spread your stateless NodeJS code across all CPUs available on a server, to keep all processes alive forever and to 0s reload them. pm2 reloads scripts when they crash, can manage multiple processes at once, and all without downtime.

It is an NPM CLI application that runs in io.js and node.js on Windows, Mac OSX, and Linux.

Main features

  • Builtin load-balancer (using the native cluster module)
  • Script daemonization
  • 0s downtime reload for Node
  • Startup scripts for Ubuntu and CentOS
  • Stop unstable process (avoid infinite loop)
  • Monitoring in console
  • HTTP API
  • Remote control and real time interface API

Questions can be tagged with "pm2" for problems with running applications using pm2.

For more information:

2258 questions
7
votes
2 answers

Error: RROR] Process or Namespace not found. PM2 Error Linux Server with github actions

I recently updated my self-hosted linux server on compute engine. Pm2 had been working perfectly along my github actions previously. However after update when i restart a pm2 instance from my ssh terminal it works fine. But when I try to restart pm2…
7
votes
2 answers

How to rotate log files while running server with pm2?

We are using node module pm2 to run the server and capturing application logs. But as the traffic is very huge, huge data is getting stored in single file which are around more than 100Gb. Is there any possibility that we change the file every 1…
Jax
  • 139
  • 2
  • 12
7
votes
0 answers

Google App Engine - PM2 - Start program failed: failed to detect app after start: ForAppStart():

Im running an app on Google App Engine, its a simple node js application, the start command i run it with is pm2 start build/index.js but i keep getting this error Start program failed: failed to detect app after start: ForAppStart():
Kravitz
  • 2,769
  • 6
  • 26
  • 53
7
votes
1 answer

node.js heap memory and used heap size [pm2]

I am currently running node.js using pm2. And recently, I was able to check "custom metrics" using the pm2 monit command. Here, information such as Heap size, used heap size, and active requests are shown. I don't know how the heap size is…
hyundeock
  • 445
  • 1
  • 6
  • 15
7
votes
0 answers

Python threading causes memory leak using pm2

What's going wrong? I have done some test and realized that when using threading with pm2 it causes memory leaks where it stacks up the threading instead of dumping them. I have tested both with pm2 vs normal terminal. When using threading I could…
PythonNewbie
  • 1,031
  • 1
  • 15
  • 33
7
votes
1 answer

getting spawn node ENOENT in pm2

I was trying to setup strapi on AWS I was following the instructions listed on their site: https://strapi.io/documentation/3.0.0-beta.x/deployment/amazon-aws.html Here is my folder structure And this would be my ecoystem.config.js…
Alwaysblue
  • 9,948
  • 38
  • 121
  • 210
7
votes
4 answers

How to use a local version of pm2 in node_modules directory to keep a server alive?

I want to keep my node server alive. Therefore I use pm2 but if I try to start my server with pm2 start index.js I get the message: pm2: command not found So, I wanted to ask how to use local pm2 in node_modules directory without installing pm2…
Operator
  • 85
  • 1
  • 7
7
votes
1 answer

Dockerfile ..... ✖ Error: Command failed: /bin/sh -c autoreconf -ivf /bin/sh: autoreconf: not found

Here is my Dockerfile: FROM node:10-alpine RUN mkdir -p /home/node/salvator/node_modules && chown -R node:node /home/node/$ WORKDIR /home/node/salvator COPY package*.json ./ USER node RUN npm install COPY --chown=node:node . . EXPOSE…
devil child
  • 71
  • 1
  • 3
7
votes
3 answers

Node.js PM2 log : App [server:0] exited with code [0] via signal [SIGKILL]

In my Node.js application I am calling an external API which takes more than 7 minutes to get the response, in the meantime I am getting this: PM2 log : App [server:0] exited with code [0] via signal [SIGKILL] and the process is getting killed.
krishna
  • 71
  • 1
  • 3
7
votes
3 answers

How to use jenkins to restart PM2?

i'm running my node.js app on the linux server using PM2, with a config file, like this: PM2 start mywebsite.config.js all is good. but now i want to add jenkins to the picture. i'm running a pipeline project in jenkins, using Jenkinsfile. All…
Ron Al
  • 397
  • 1
  • 6
  • 19
7
votes
1 answer

How to make socket.io work properly with pm2 cluster mode?

I have been looking at various solutions around but when I put it all together, it looks very confusing. I am trying to implement pm2 cluster mode for my application which has socket.io implementation. Now, I understand the concept that…
Yogesh
  • 453
  • 1
  • 4
  • 12
7
votes
2 answers

pm2 script execution path is incorrect, doesn't match the one in ecosystem.config.js

My ecosystem.config.js looks like this: module.exports = { apps: [{ name: 'production', script: '/home/username/sites/Website/source/server.js', env: { NODE_ENV: 'PRODUCTION' }, args: '--run-server' }, { name: 'staging', …
BBales
  • 6,588
  • 3
  • 16
  • 19
7
votes
1 answer

What is the use of pm2 scale option?

Actually I'm unable to understand the use of pm2 scale [app-name] 10 but I know pm2 start app.js -i 4 is used for starting instances of app in cluster mode. And one other question what would happen if I'll set number of clusters as -1 means pm2…
Srinivas Nahak
  • 1,846
  • 4
  • 20
  • 45
7
votes
3 answers

How to run multiple app using PM2?

I want to run my angular4 app using PM2 it will run but when I am close the terminal it will stop. On this server already run one application, it is working properly, but in my app it will work when I am open the terminal, otherwise it will stop…
Apurv Chaudhary
  • 1,672
  • 3
  • 30
  • 55
7
votes
2 answers

Error: Cannot connect to runtime; make sure that runtime is in 'legacy' debug mode

I see the above when trying to debug Node.js script with Visual Studio Code. My launch.json looks like { "version": "0.2.0", "configurations": [ { "type": "node", "request": "attach", "name":…
Adam Bubela
  • 9,433
  • 4
  • 27
  • 31