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
0
votes
0 answers

Django runs on pm2 but nginx fails to start

We are running Django app using PM2 with following script: apps: [{ name: "app_name", script: "manage.py", args: ["runserver", "127.0.0.1:8000"], exec_mode: "fork", instances: "1", wait_ready:…
user2284357
0
votes
1 answer

Can not run PM2 with babel-node as interpreter

I've tried everything in the docs but nothing seems to work. When I manage to run the interpreter with babel-node then the following error occurs uncaughtException: process.send is not a function. With the following configuration the interpreter is…
Kristian Vasilev
  • 504
  • 8
  • 26
0
votes
1 answer

pm2 how to kill one ecosystem wihtout kiling another one?

I'm kinda new to pm2 and I'm in a situation where I have two ecosystem that are identical, here's how that happened : I have one ecosystem that was working fine, but a few days ago when I tried to use pm2 list or any commands using process pid I…
Xanthous
  • 442
  • 3
  • 12
0
votes
0 answers

How to run pm2 in jenkins wihtout killed by jenkins

My Jenkins is killing the pm2 process once its completed the job. I have tried both freestyle and pipeline , also set the BUILD_ID and NOODE_Cookie too. Nothing works, once the pm2 starts and completes, Jenkins kill it, so when I login to server and…
deepak nest
  • 1
  • 1
  • 2
0
votes
1 answer

Postgresql connect ECONNREFUSED after random amount of time

i checked so many other questions but none have this specific problem. i have a NodeJs Express Postgresql app deployed on Digital Ocean, Ubuntu 22.04 x64, Droplet. the app is running on port 8080. I used nginx and pm2 and postgresql version 14. at…
junior_ali
  • 11
  • 3
0
votes
0 answers

The pm2 run the python file errored

My server system is Debian. I use pm2 to manage the process. One of the processes is a python backend. I have created a venv environment for it and activated it. I use this command to change ownership of the directory. sudo chown myuser…
0
votes
0 answers

Does PM2 process manager cache all files used until PM2 restart?

Assuming a node.js app running with PM2-process-manager and a PM2-"watch_delay" of 60000ms: When files of the node.js-app are updated and also packages are updated via npm i it is not influencing the running PM2-processes, until the "watch_delay" is…
Peter
  • 323
  • 4
  • 15
0
votes
1 answer

Reacting to PM2 events

Can I run a script when some event happens? For example, I want to be notified every time the process restart because it's caused by some reason I'd like to investigate. I looked into both PM2 nodejs API and docs but didn't find info about it.
Sergei Basharov
  • 51,276
  • 73
  • 200
  • 335
0
votes
1 answer

What is the time unit for pm2 watch_delay option?

The pm2 docs say there is an option to set a watch-delay in a configuration file like this: module.exports = { apps: [{ script: "app.js", watch: ["server", "client"], // Delay between restart watch_delay: 1000, ignore_watch :…
Andrew Hulterstrom
  • 1,563
  • 4
  • 18
0
votes
0 answers

Getting error Cannot use import statement outside a module when using pm2

Hello i am running Ubuntu server on "digitalocean" but getting error when trying to run my app using pm2 start App.js at first it shows as its online but ones you pm2 list its says errored and in the logs you can see…
John
  • 1
  • 1
0
votes
1 answer

How to install pm2-logrotate

I am trying to install pm2-logrotate, sudo pm2 install pm2-logrotate I am getting [PM2][Module] Installing NPM pm2-logrotate module [PM2][Module] Calling [NPM] to install pm2-logrotate ... npm ERR! code EAI_AGAIN npm ERR! errno EAI_AGAIN npm ERR!…
aharo vishinsky
  • 131
  • 1
  • 4
  • 12
0
votes
1 answer

How to reload Node.JS app without losing current open requests?

I'm using pm2 to reload my app but in my test the active requests are cancelled by the reload. I tested by making an endpoint with an await of 10 seconds, requesting a response to this endpoint with Insomnia and then, before the 10 seconds await…
Márcio Valim
  • 2,459
  • 3
  • 10
  • 21
0
votes
1 answer

When running two NodeJs apps in same vps one use others .env conf and get connected to the wrong db

I have a VPS with Instance (Debian 9.4 (stretch) 20180404) There I have a few WordPress sites and also a nodejs app that I will call "prod" running with PM2 without any problem whit apache2. Now I want to run a new nodejs app on a subdomain which…
0
votes
0 answers

endpoints no funcionan en AWS con NGINX

I made a simple app with nodejs and ejs templates for the views, the app in my local works perfectly, but when I deploy in AWS only the main page works and the login buttons etc. I get a proxy error. this is the structure of my app my…
Valeria
  • 1
  • 1
0
votes
1 answer

Pm2 unable to access SSL cert and Key files even though I have permission to access those files

When I deployed my mern app on our server it throwed me a EAccess error saying unable to access my cert and key files of ssl however then I created a group for me and my root with adequate permissions so that my node server can access those files…