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

Update node on server running multiple apps

I got an Ubuntu 18 server running multiple node apps, unfortunately I did not install node using nvm. All of the apps are running with pm2 and are currently online. One of the apps I just finished requires a higher version from the current v15.3.0 I…
Álvaro
  • 2,255
  • 1
  • 22
  • 48
0
votes
1 answer

Pm2 stops my app after github action finishes

I wrote a script deploy.sh to run as a step in the .github/deploy.yml file. This is the part in the yaml file where I execute the shell scipt - name: Execute script uses: appleboy/ssh-action@master with: host: ${{…
hkisthebest
  • 101
  • 1
  • 9
0
votes
0 answers

Load node JS Web app so slow in VPS with pm2

Im using pm2 start app.js --watch but it's very slow to reload my web app. It always must to refresh the browser for get the page fast. What should i do?
Kung Timo
  • 1
  • 1
0
votes
1 answer

Is it okay to run multiple nodejs processes on a single core?

Ok, so the thing is, we have multiple NodeJS web servers which need to be online all the time. But they'll not be recieving many requests, approx. 100-200 requests a day. The tasks aren't CPU intensive either. We are provisioning EC2 instances for…
0
votes
1 answer

NodeJS eventLoop + ExpressJS unexpected behaviour with concurrency requests on single route

I have a simple express App with a single route: const express = require("express"); const app = express(); const crypto = require("crypto"); app.get('/', (req, res, next) => { const start = new Date() console.log('Start timestamp',…
A.Polieshchuk
  • 37
  • 1
  • 5
0
votes
1 answer

Connection refused, while connecting to upstream on engintron/nginx deployment

I've dealt with this error in the nginx error log for the past few hours. *2 connect() failed (111: Connection refused) while connecting to upstream, client: my ip, server: my domain, request: "GET / HTTP/2.0", upstream: "http://127.0.0.1:3000/",…
0
votes
1 answer

Can you Export pm2 logs to .json, or csv?

Afternoon The Marketing Team have lost alot of data at my current place of work. I am running PM2 in putty I am currently using pm2 logs 'applicationname' -1000 lines to get the data I need This works But is there a good way to export the…
0
votes
1 answer

Running npm start on pm2 server returns Error: Cannot find module Cors

When I run npm start or even pm2 start npm --name "app name" -- start command, my app returns an error like this: /home/cloud/sites/myapp$ npm start > myapp@1.0.0 start /home/cloud/sites/myapp > node server.js internal/modules/cjs/loader.js:818 …
Deesak
  • 153
  • 1
  • 16
0
votes
0 answers

Pm2 process restarting each 8 hours

I have a program developed in typescript, a function is executed each hour (I have try to execute it each 5, 10 min) and that is defined in index.ts that I execute with pm2 start "npm start". In the index I define that the first time the function is…
0
votes
1 answer

Deploy app via pipeline using ssh and PM2

I am using Gitlab CE for CI/CD, and I have a pipeline to deploy to an ubuntu server, which runs the apps with pm2. The actions are: Removes /node_modules, /dist and /tmp folders Pulls updated code Builds the code into /dist Removes the app from…
Emille C.
  • 315
  • 2
  • 15
0
votes
0 answers

pm2 is not recognized as an internal or external command, in Github Action

I added a self hosted runner in github action. i want to deploy my code with pm2. My workflow file. runs-on: self-hosted strategy: matrix: node-version: [ 15.x ] steps: - uses: actions/checkout@v3 - name: Use Node.js ${{…
colony
  • 1
  • 1
0
votes
1 answer

PM2 unexpected string error with serverless

When I try to use PM2 for serverless offline, I get the following error message. 0|fhirwork | /tmp/yarn--1652132529763-0.26304909057877546/yarn:3 0|fhirwork | exec "/home/linuxbrew/.linuxbrew/Cellar/node@16/16.14.2/bin/node"…
Linden X. Quan
  • 584
  • 5
  • 18
0
votes
1 answer

Facing problem with PM2 server throwing Javascript heap out of memory on EC2

I am tyring since last night but just not able to get around this problem. I am currently deploying a NodeJs application on ec2 instance and it is built using Typescript. The server has 8gb ram and 30 gb storage and is having NodeJs v16.15.0. So…
Radheya
  • 779
  • 1
  • 11
  • 41
0
votes
2 answers

Async/await function not awaiting after creating write stream

I have a node app that uses express for routing and pdfmake npm for generating a pdf document. On the click of a button, I make an http request that retrieves data from a database, generates a pdf document, and saves to disk. However, my async/await…
homes
  • 265
  • 1
  • 3
  • 12
0
votes
2 answers

PM2 only auto restart between specific time?

Not sure how to make pm2 run a Javascript that restart at 23 PM 59 sec everyday then enables auto restart for 10 mins to next day's 00:09 then no-autorestart for the rest of the day until reaching 23:59 again... Only able to set it to restart at…
Peanut Jams
  • 374
  • 2
  • 9
1 2 3
99
100