Unitech / Unitech/pm2

daemon.js always tries to use node from path - how to use specific version?

Open
#5,442 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
43.3k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

What's going wrong?

If there's a NodeJS installation on a system, pm2 is using that via PATH environment to run daemon.js. This does neither take into account the version of nodejs that's running pm2, nor any version specified by "--interpreter".

However, as it seems, as long as there's no nodejs reachable via PATH, the executing nodejs of pm2 will be used for daemon.js.

pm2 should behave the same in both cases (especially as there's apparently no way to change the executable for daemon.js). It's not always feasable to change the PATH before calling pm2.

How could we reproduce this issue?

  • install nodejs, callable via PATH
  • use another local version to start pm2, eg: bin/node node_modules/pm2/bin/pm2 report
  • compare "Daemon" and "CLI"

Supporting information

pm2 5.2.0 (Windows)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with daemon.js and the pm2 report command used in the reproduction, comparing the reported Daemon and CLI runtimes. Verify behavior with a PATH-installed Node.js and a separate local Node.js executable. Done means daemon.js uses the intended PM2 runtime rather than an unrelated Node.js found through PATH.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.