question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Starting via PM2 no more possible

See original GitHub issue

⚠️ Please verify that this bug has NOT been raised before.

  • I checked and didn’t find similar issue

πŸ›‘οΈ Security Policy

πŸ“ Describe your problem

I just restarted my server and was curious about a 100 % CPU usage by PM2 and and node.

So I first upgraded from v1.12.0 and then restarted Uptime Kuma via pm2 restart /opt/uptime-kuma/server/server.js --name uptime-kuma and now the services doesn’t start anymore.

The console output is:

pm2 restart /opt/uptime-kuma/server/server.js --name uptime-kuma
Use --update-env to update environment variables
[PM2] Applying action restartProcessId on app [/opt/uptime-kuma/server/server.js](ids: [ 0 ])
[PM2] [uptime-kuma](0) βœ“
β”Œβ”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ id  β”‚ name           β”‚ namespace   β”‚ version β”‚ mode    β”‚ pid      β”‚ uptime β”‚ β†Ί    β”‚ status    β”‚ cpu      β”‚ mem      β”‚ user     β”‚ watching β”‚
β”œβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 0   β”‚ uptime-kuma    β”‚ default     β”‚ 1.16.1  β”‚ fork    β”‚ 85229    β”‚ 0s     β”‚ 470  β”‚ online    β”‚ 0%       β”‚ 14.1mb   β”‚ root     β”‚ disabled β”‚
β””β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Usually it starts a second process.

If I look into pm2 monit, it sells me: [SERVER] ERROR: Error: Cannot find β€˜dist/index.html’, did you install correctly?

Since it tries to restart every second, this would explain the high CPU usage.

If I start the server via node server/server.js it works fine.

I just looked into the server/server.js file and noticed that process.cwd() returns /opt/uptime-kuma if I start it via node but /opt/uptime-kuma/server if I start it via pm2. So I think it has something to do with this but I’m not that into nodejs to be sure. Thus I hope to get help on this.

🐻 Uptime-Kuma Version

1.16.1

πŸ’» Operating System and Arch

Debian 11

🌐 Browser

Safari 15.5

πŸ‹ Docker Version

No response

🟩 NodeJS Version

16.15.0

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
MatzeKittcommented, May 31, 2022

I just reinstalled pm2 including removing its config from ~/.pm2/ and now it works fine. πŸ€·πŸ»β€β™‚οΈ

Thank you for helping me out, though!

0reactions
Computronikscommented, May 31, 2022

Hmm, odd. Can you try running the install script in a directory that doesn’t require root priviledges i.e users home dir or perhaps doing the manual install https://github.com/louislam/uptime-kuma/wiki/πŸ”§-How-to-Install#-without-docker-recommended-for-x86x64-only instead of the install script

Read more comments on GitHub >

github_iconTop Results From Across the Web

Quick Start - PM2
The simplest way to start, daemonize and monitor your application is by using this command line: $ pm2 start app.js. Or start any...
Read more >
Why is PM2 not launching my Node process? - Stack Overflow
My node app does run just fine if I start it manually, but nothing I do gets it to run via PM2, even...
Read more >
A Complete Guide to Node.js Process Management with PM2
This in-depth guide runs you through the key features of Node.js process manager PM2.
Read more >
How to Deploy, Manage and Scale Node.js Apps with PM2
Learn the most important PM2 features and how to use them to deploy, manage, and scale your Node.js applications in production.
Read more >
Starting Node-RED on boot
If you are not using Raspberry Pi OS, you may need to edit the service file to ... More information about managing processes...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found