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

PM2 error - Cannot use import statement outside a module

Working with a React app and trying to start it with pm2, but when I write the command: pm2 start ecosystem.config.json it starts the app, but it is errored. When I write pm2 logs it says import…
OmarLittle
  • 423
  • 1
  • 9
  • 18
0
votes
0 answers

SyntaxError: Unexpected identifier (set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix. When starting pm2 server

Hello im trying to start a pm2 server to deploy my nextjs app on nginx on my raspberry pi using this blog and it worked but when i rebooted my raspberry pi i got 502 Bad Gateway on my website because pm2 wasn't started on boot. So i tried to run it…
maurijn.vd
  • 111
  • 1
  • 9
0
votes
1 answer

Using PM2 to deploy a React app in production environment

I am trying to deploy my React app on a server via PM2. My React app currently has 2 environments: prod and dev. So, in my app folder, I have an environments folder with 2 files: .dev.env and .prod.env. First one is used for calling local APIs, and…
OmarLittle
  • 423
  • 1
  • 9
  • 18
0
votes
1 answer

Node JS passport-saml authentication fails with "preflight request doesn't pass access control check" when deploying multiple instance using pm2

I have tried plenty of answers posted for a similar question but my issue is slightly different from straight forward CORS issue. I am using passport-saml with my Node JS app to authenticate my web-application with ADFS. Everything works fine as…
Nick Div
  • 5,338
  • 12
  • 65
  • 127
0
votes
0 answers

NodeJS, using concurrently to run scripts to start pm2 ecosystem + monit and jsreport

I'm using npm version 8.5.2, pm2 version 5.2.2 and concurrently version 7.4.0. I'm trying to create a script to start my server through pm2 ecosystem.config.js and using pm2 monit while opening a new cmd.exe to run jsreport These are my…
alesssz
  • 384
  • 4
  • 18
0
votes
1 answer

pm2 not creating separate log file when ran on all instances

I am trying to run my node application across all CPUs that I have. The command i am using is pm2 start index.js -i max --output logdir/access.log --error logdir/error.log the problem with this is it creates 2 files in logdir a.k.a "access.log"…
Sid
  • 115
  • 1
  • 10
0
votes
1 answer

Issues exposing port with Traefik, node and pm2

I'm running Traefik v2.0 in a docker environment, but I'd like to expose a node app I'm running on port 5000 outside of docker with pm2 as well. My current setup: docker-compose.yml for Traefik: version: '3' services: traefik: image:…
MatiasLN
  • 49
  • 6
0
votes
1 answer

How to solve problem protocol error (IO.read): Read failed with PM2 and puppeteer

I've this simple code in index.js const puppeteer = require('puppeteer'); (async () => { const browser = await puppeteer.launch(); const page = await browser.newPage(); await page.goto('https://example.com'); await page.pdf({ path:…
XMehdi01
  • 5,538
  • 2
  • 10
  • 34
0
votes
0 answers

How I run pm2 with host by ec2

Trying to start pm2 it runs for a run then crashes right after this log pops up constantly. /home/ubuntu/418_Assign_3/express/assign3.html:1 ^ SyntaxError: Unexpected token '<' at Object.compileFunction (node:vm:360:18) at wrapSafe…
0
votes
0 answers

Ionic pm2 - Start app in dev as in "ionic serve" but with pm2

How to start an Ionic app with pm2 for development with hot-reload? I know this works for a ReactJS app: pm2 start npm --name "app name" -- start Is there a way to basically run ionic serve but with pm2 for monitoring and testing purposes? I am not…
Alex K
  • 43
  • 11
0
votes
1 answer

How to deploy Vue with PM2

I have a vue3 + vitejs application that I would like to deploy on windows with pm2. When I run the npm start myapp command, the status is in error. Can you help me please? ecosystem.config.js name: 'myapp', cwd: 'C:\myapp', script: 'npm', args: 'run…
jeyGey
  • 161
  • 3
  • 15
0
votes
0 answers

Performance with RabbitMQ and Nodjes

I am developing an application where I am listing to incoming RabbitMQ messages. I am using Node.JS and the amqplib library. As my process manager I use pm2. I am listening to a topicExchange from RabbitMQ and there a multiple variants of topics…
Bernd Loigge
  • 1,647
  • 1
  • 14
  • 17
0
votes
1 answer

Deploying Multiple NodeJS Servers on a Single DigitalOcean Droplet; Managed by PM2, Without Using an ecosystem.config.js file

Firtly, my servers are nginx-based and certified by certbot - let's encrypt. Hence, I'm assuming you're acquainted with this setup. Now, unto the epicenter of our problem. A major problem using the prescribed (best-practise) procedure for deploying…
0
votes
0 answers

my github self-hosted runner does not deploying correctly

I have a simple self hosted runner which runs on ubuntu ec2 machine. part of my Yaml file jobs: development: runs-on: self-hosted steps: - uses: actions/checkout@v2 - name: Use Node.js uses: actions/setup-node@v2 with: …
0
votes
0 answers

Apache2, Node and Pm2 Project deployment issue

I use Linode server (Dedicated CUP 4 core with Ram 8) but the server is does not work well. The server response too long time when pm2 app memory reach out above 100mb. It is happing on this condition. Is it require to upgrade my server? (Ram 16…