Unitech / Unitech/pm2

PM2 module installation should support other package managers

Open
#6,150 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

node -v  # v24.20.0
pnpm -v  # 12.3.1
npm -v   # NOT FOUND — zsh: npm: 명령을 찾을 수 없습니다...
pm2 -v   # 7.0.4

pm2 install pm2-logrotate

The error happens in /pm2/lib/API/Modules/NPM.js:

[PM2][Module] Calling [NPM] to install pm2-logrotate ...
node:child_process:585
  validateString(file, 'file');
  ^

TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received null
    at normalizeSpawnArguments (node:child_process:585:3)
    at spawn (node:child_process:806:13)
    at /home/hyunbinseo/.local/share/pnpm/global/v11/525b6-18d2725b77324f18-0/node_modules/.pnpm/pm2@7.0.4_supports-color@7.2.0/node_modules/pm2/lib/API/Modules/NPM.js:216:74 {
  code: 'ERR_INVALID_ARG_TYPE'
}

Node.js v24.20.0

npm might not exist in the system, so respecting the package manager used to install PM2 would be nice.

Installing a Node.js runtime via node@runtime:<version> (including pnpm env use and pnpm runtime set node) no longer extracts the bundled npm, npx, and corepack from the Node.js archive.

https://pnpm.io/blog/releases/11.0#slimmer-runtime-installs

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 in /pm2/lib/API/Modules/NPM.js, especially the spawn call around line 216, and reproduce the reported pm2 install pm2-logrotate failure in an environment with pnpm but no npm. Trace how the package manager executable is selected; done means module installation works when npm is unavailable and uses the package manager available to PM2.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.