pm2 with pnpm bug

Open
#5,416 13 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Start by reproducing pm2 start pnpm -- run start with the reported PM2 5.2.0, Node.js 18.4.0, and pnpm setup, then trace how PM2 launches the pnpm executable. Done means the command starts the application without Node.js parsing pnpm's launcher as JavaScript.

Written by the indexing model from the issue text.

Description

What's going wrong?

When using pm2 with pnpm an error ocurrs

/home/ubuntu/.local/share/pnpm/pnpm:2
0|pnpm  | basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
0|pnpm  |           ^^^^^^^
0|pnpm  | SyntaxError: missing ) after argument list
0|pnpm  |     at Object.compileFunction (node:vm:353:18)
0|pnpm  |     at wrapSafe (node:internal/modules/cjs/loader:1040:15)
0|pnpm  |     at Module._compile (node:internal/modules/cjs/loader:1076:27)
0|pnpm  |     at Module._extensions..js (node:internal/modules/cjs/loader:1166:10)
0|pnpm  |     at Module.load (node:internal/modules/cjs/loader:988:32)
0|pnpm  |     at Module._load (node:internal/modules/cjs/loader:834:12)
0|pnpm  |     at Object.<anonymous> (/home/ubuntu/.local/share/pnpm/global/5/.pnpm/pm2@5.2.0/node_modules/pm2/lib/ProcessContainerFork.js:33:23)
0|pnpm  |     at Module._compile (node:internal/modules/cjs/loader:1112:14)
0|pnpm  |     at Module._extensions..js (node:internal/modules/cjs/loader:1166:10)
0|pnpm  |     at Module.load (node:internal/modules/cjs/loader:988:32)

How could we reproduce this issue?

Just install pnpm https://pnpm.io/
And start an app with pnpm pm2 start pnpm -- run start

Supporting information

--- PM2 report ----------------------------------------------------------------
Date                 : Thu Aug 04 2022 17:10:19 GMT+0000 (Coordinated Universal Time)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version         : 5.2.0
node version         : 18.4.0
node path            : /home/ubuntu/.local/share/pnpm/pm2
argv                 : /usr/bin/node,/home/ubuntu/.local/share/pnpm/global/5/.pnpm/pm2@5.2.0/node_modules/pm2/lib/Daemon.js
argv0                : node
user                 : ubuntu
uid                  : 1001
gid                  : 1001
uptime               : 0min
===============================================================================
--- CLI ----------------------------------------------------
local pm2            : 5.2.0
node version         : 18.4.0
node path            : /home/ubuntu/.local/share/pnpm/pm2
argv                 : /usr/bin/node,/home/ubuntu/.local/share/pnpm/global/5/node_modules/pm2/bin/pm2,report
argv0                : node
user                 : ubuntu
uid                  : 1001
gid                  : 1001
===============================================================================
--- System info --------------------------------------------
arch                 : arm64
platform             : linux
type                 : Linux
cpus                 : Neoverse-N1
cpus nb              : 4
freemem              : 24124837888
totalmem             : 25153310720
home                 : /home/ubuntu
===============================================================================
--- PM2 list -----------------------------------------------
┌────┬────────────────────┬──────────┬──────┬───────────┬──────────┬──────────┐
│ id │ name               │ mode     │ ↺    │ status    │ cpu      │ memory   │
└────┴────────────────────┴──────────┴──────┴───────────┴──────────┴──────────┘
[PM2][WARN] Current process list is not synchronized with saved list. App BaraSupremacy BaraSupremacyAPI BaraSupremacyClient BaraSupremacyTelegram differs. Type 'pm2 save' to synchronize.
===============================================================================
--- Daemon logs --------------------------------------------
/home/ubuntu/.pm2/pm2.log last 20 lines:
PM2        | 2022-08-04T17:08:44: PM2 log: PM2 successfully stopped
PM2        | 2022-08-04T17:10:19: PM2 log: ===============================================================================
PM2        | 2022-08-04T17:10:19: PM2 log: --- New PM2 Daemon started ----------------------------------------------------
PM2        | 2022-08-04T17:10:19: PM2 log: Time                 : Thu Aug 04 2022 17:10:19 GMT+0000 (Coordinated Universal Time)
PM2        | 2022-08-04T17:10:19: PM2 log: PM2 version          : 5.2.0
PM2        | 2022-08-04T17:10:19: PM2 log: Node.js version      : 18.4.0
PM2        | 2022-08-04T17:10:19: PM2 log: Current arch         : arm64
PM2        | 2022-08-04T17:10:19: PM2 log: PM2 home             : /home/ubuntu/.pm2
PM2        | 2022-08-04T17:10:19: PM2 log: PM2 PID file         : /home/ubuntu/.pm2/pm2.pid
PM2        | 2022-08-04T17:10:19: PM2 log: RPC socket file      : /home/ubuntu/.pm2/rpc.sock
PM2        | 2022-08-04T17:10:19: PM2 log: BUS socket file      : /home/ubuntu/.pm2/pub.sock
PM2        | 2022-08-04T17:10:19: PM2 log: Application log path : /home/ubuntu/.pm2/logs
PM2        | 2022-08-04T17:10:19: PM2 log: Worker Interval      : 30000
PM2        | 2022-08-04T17:10:19: PM2 log: Process dump file    : /home/ubuntu/.pm2/dump.pm2
PM2        | 2022-08-04T17:10:19: PM2 log: Concurrent actions   : 2
PM2        | 2022-08-04T17:10:19: PM2 log: SIGTERM timeout      : 1600
PM2        | 2022-08-04T17:10:19: PM2 log: ===============================================================================

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

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.

More from Unitech/pm2

All issues in Unitech/pm2

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.