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
10
votes
1 answer

GitHub Actions workflow error: Run Command Timeout! Even if the script did well

I want to deploy my Nuxt.js application on my remote server each time I commit into repository. Here is my deploy.yml: name: 'Deployment' on: push: branches: ['master'] jobs: deploy: name: Deploy runs-on: ubuntu-latest steps: …
10
votes
3 answers

Can PM2 run command line start scripts?

I'm using a library, say I want the script that starts my app to be cli-lib start how can i go about that? I don't want to just run node app.js or any js file for that matter, the cli lib does that for me but i cant figure out a way to get this to…
gottimaneee
  • 101
  • 1
  • 1
  • 3
10
votes
1 answer

pm2 creates a "source" directory and copies all my files inside, why?

I deleted my previous question because it was not very clear, and the problem was not clearly exposed. I have an instance @aws, a repository @gitlab, and gitlab CI is setup. I made a little app in node.js because I want to try all these new…
mathieun7
  • 173
  • 1
  • 1
  • 8
10
votes
1 answer

How to resolve In-memory PM2 is out-of-date

Amazon AWS Ubuntu server ~$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 16.04.5 LTS Release: 16.04 Codename: xenial Problem: PM2 is out-of-date $ pm2 list >>>> In-memory PM2 is out-of-date,…
zabumba
  • 12,172
  • 16
  • 72
  • 129
10
votes
4 answers

PM2 shows old version when re-building app

My node-app is running in PM2. When I pull the latest version of my app off github and rebuild it, the site during the building process defaults to a much older version (probably the first version when I initially launched the daemon). How can I…
Ansjovis86
  • 1,506
  • 5
  • 17
  • 48
10
votes
2 answers

Elastic Beanstalk Node.Js needs PM2 or Forever

In my local node server , it fails on any uncaught exception and has to be manually restarted. So local was run using either forever or pm2. But my development server is AWS Elastic Beanstalk with Node.Js environment .Though it logs uncaught…
Janier
  • 3,982
  • 9
  • 43
  • 96
10
votes
1 answer

How can I debug a Node.js application running with PM2 in VSCode?

Visual Studio code has some awesome debug functionality built in that makes it easy to debug applications with node. However, my application is configured to use PM2. How can I set up Visual Studio Code to debug with PM2?
Chandler Freeman
  • 899
  • 1
  • 10
  • 25
10
votes
4 answers

PM2 and Nginx: 502 Bad Gateway

I've been trying to deploy my Node project on a brand new DO droplet, but i'm having some problems with PM2. My steps are a follows: Node came installed on the Droplet image (Ubuntu, Node v4.4.4) Installed PM2 globally Setup Nginx to reverse proxy…
Jacob K
  • 408
  • 1
  • 5
  • 16
10
votes
5 answers

Ubuntu 14.04 - pm2 startup not starting after reboot

I am using pm2 to start a node.js process, and I would like this process to be started automatically when the system (Ubuntu 14.04 on Intel Atom processor) is booted. I have followed the instructions on the pm2 web site but without success. My…
Max
  • 2,121
  • 3
  • 16
  • 20
10
votes
4 answers

custom logging under pm2

I have some useful logging in my node app that I write to console.log node server.js >> /var/log/nodeserver.log 2>&1 However, when trying the same under pm2: pm2 start server.js >> /var/log/pm2server.log 2>&1 the log file only shows the pm2…
user542319
  • 403
  • 2
  • 5
  • 14
10
votes
2 answers

How to use PM2 CLI on Heroku

I'm trying to use pm2 on Heroku. I did have a look at the documentation. It looks like the application works fine once deployed, and the logs indicates that multiple instances has started on a 2X dyno. Yet when I run: heroku run bash and do a pm2 ls…
adc06
  • 793
  • 8
  • 23
10
votes
4 answers

Forever errors with babel-node

I have a simple node server: //server.js import express from 'express'; import React from 'react'; ... When I try to run this using Forever: forever start -c "babel-node --experimental" server.js , it errors out due to use of…
a_rahmanshah
  • 1,636
  • 2
  • 22
  • 35
10
votes
1 answer

Confusion about pm2 restart vs reload

Issuing "pm2 restart all" will restart all of the processes pm2 is managing. I am wondering: If there have been changes to any of the source files, does this actually reload the changes? Or does it just restart the existing pm2 process in memory.
user1031947
  • 6,294
  • 16
  • 55
  • 88
9
votes
1 answer

Access env variables in node js app when using gitlab ci cd pipeline

I am using gitlab ci cd pipe line to deploy my application to ubuntu server. I have different .env file for local and for dev env and its not a part of git repo (included in gitignore) how to get env variables in my app when deployed to ubuntu…
gANDALF
  • 360
  • 4
  • 21
9
votes
2 answers

Debugging With PM2 And Vscode

Visual Studio code has some awesome debug functionality built in that makes it easy to debug applications with node. However, my application is configured to use PM2 version 3.4.1. node version 6.17.1 How can I set up Visual Studio Code to debug…
ABDUL JAMAL
  • 452
  • 7
  • 12