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

Advice on managing a MERN app in production

I have a full-stack app I've developed myself using the MERN stack (+ socket.io and meilisearch). It has been deployed for a few months and started crashing intermittently with no discernible pattern. I was working on implementing PM2 to try and…
0
votes
1 answer

Prevent "EADDRINUSE" with pm2?

I am about to switch my node application server from phusion passenger to pm2. Most of the ports of my apps are set to 3001. With passenger that's never been a problem, but with pm2 ports collide (EADDRINUSE). Do I have to set a different port for…
LongHike
  • 4,016
  • 4
  • 37
  • 76
0
votes
0 answers

Gateway timeout when adding username and password

I'm trying to add basic authentication to a nginx reverse proxy which is in front of a nuxtjs app. I've configured nginx as so server { server_name ; auth_basic "Restricted Content"; auth_basic_user_file…
user2099762
  • 173
  • 2
  • 12
0
votes
1 answer

Python script throws module not found error in pm2 but works in cmd

I want to demonise a python script with pm2 that worked before. I've created a venv with Python 3.6.8. I installed all modules that are required and tryed the script via console, which works. But if I start the module via pm2, I get an…
user3793935
  • 411
  • 5
  • 22
0
votes
0 answers

502 Bad Gateway On page reload Nginx error on running NodeJS website built with ejs

When I first visit the website, it loads correctly. but on refresh, it gives me the error 502 Bad Gateway Nginx/1.14.0 (Ubuntu). I am deploying a simple e-commerce site with nodejs. I am using vps which is running ubuntu-18.04-x86_64. Below is what…
Seyyid Said
  • 475
  • 2
  • 6
  • 16
0
votes
1 answer

How to run PM2 in a distroless image

I want to run node application with pm2 in distroless image. As it do not have any shell inside it.
0
votes
1 answer

Missing one .js resource from .nuxt/dist/client folder after yarn build

I'm trying to deploy my Nuxt project using apache and pm2. The nuxt project will be the front-end, and it has a backend api that is on a different domain. I got the virtual host setup fine, I can access the login page but for some reasons, it always…
Ian Jay
  • 82
  • 1
  • 2
  • 11
0
votes
1 answer

forever-monitor fails when run with pm2 on digitalocean droplet - Target script does not exist

I have a node app with forever-monitor. When I run it locally it works correctly. When I run it manually on a digitalocean droplet with node app-fm.js it also run correctly. However, when It tries to start with pm2 it get error-ed. Checking the pm2…
learntheropes
  • 444
  • 3
  • 11
0
votes
0 answers

WebSocket is closed before the connection is established. NextJS+socket.io+PM2

This is my first experience with socket. My project stack: NextJS(v10), express, socket.io, socket.io-client, freeice Everything works fine on localhost. The problem arose when I decided to test on a test server(started project with…
Roman Nozhenko
  • 698
  • 8
  • 21
0
votes
1 answer

dotenv not updating on the React frontend with pm2

I have deployed my MERN app on aws ec2 ubuntu and I am using dotenv to load my environment variables, using pm2 for the server and also using nginx. In the server I am trying to load the values on my .env file which sits in the server directory, and…
Joshua
  • 1,005
  • 1
  • 11
  • 16
0
votes
0 answers

Error [ERR_REQUIRE_ESM] in nuxtjs 2 while deploying with ec2

Getting error of Error [ERR_REQUIRE_ESM] while deploying nuxtjs 2 application. Scripts: "build": "nuxt build", "start": "./node_modules/pm2/bin/pm2 start pm2.config.json" Errors: Error [ERR_REQUIRE_ESM]: require() of ES Module…
ks221197
  • 1
  • 1
0
votes
0 answers

NODE JS - cron jobs in cluster mode or behind a load balancer executing multiple times

I have a NestJS server working in cluster mode on ec2 instance using pm2. I have successfully set up cron jobs executing only one time in the cluster mode by starting the server with multiple name configurations using the name of the pm2 process. { …
Harish Jangra
  • 381
  • 5
  • 16
0
votes
1 answer

How to run java jar file on AWS EC2 server

How to ran Java Jar file in AWS EC2 server. I have tried - nohup java -jar myfilename.jar > output.log & With the above approach, I will store the logs in output.log file. I want to rotate it after 150 MB completed, Without stopping the…
Atique Ahmed
  • 308
  • 4
  • 16
0
votes
1 answer

Run node as a service with pm2

I am trying to run a node api as a service but when I run the following command C:\Windows\System32>pm2-service-install -n 0PM2 it asks the following question Perform environment setup (recommended)? I put yes but it stays there and does…
senseilex
  • 17
  • 1
  • 5
0
votes
0 answers

Trouble making http request from lighttpd server to pm2 server

Background: I have my personal website running on a lighttpd server on my raspberry pi. I have that server’s port (80) forwarded so it can be accessed publicly. I’m in the process of making a project, and I want a node.js service to make requests to…
1 2 3
99
100