pm2 list is showing a wrong app version when it executes a script from ecosystem file
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 you execute pm2 list it does not show the right version for an app in the table:
| id | name | namespace | version | mode | pid | uptime | ↺ |
|---|---|---|---|---|---|---|---|
| 0 | sampleapp | default | 0.37.0 (this is wrong, it shoud show the package.json version) | cluster | 43140 | 0s | 0 |
How could we reproduce this issue?
- Create a NextJS App.
- Build the App using next build.
- Create an ecosystem file:
module.exports = { apps: [{ name: 'sampleapp', script: 'yarn', args: 'start', // Options reference: https://pm2.io/doc/en/runtime/reference/ecosystem-file/ instances: 1, autorestart: true, watch: false, max_memory_restart: '1G', env: { NODE_ENV: 'development' }, env_production: { NODE_ENV: 'production' } }] } - Run pm2 start ecosystem.config.js --dev production
- Do pm2 list
- You should see in the table the app version of your package.json file, but pm2 showed version 0.37.0. (I tested it on pm2 4.5.6 and pm2 5.1.0).
Supporting information
$ pm2 report
PM2 | 2021-07-02T10:18:45: PM2 log: App [sampleapp:0] starting in -cluster mode-
PM2 | 2021-07-02T10:18:45: PM2 log: App [sampleapp:0] online
PM2 | ready - started server on 0.0.0.0:8888, url: http://localhost:8888
PM2 | info - Loaded env from /home/usr/sampleapp/.env.local
PM2 | 2021-07-02T10:18:55: PM2 log: Stopping app:sampleapp id:0
PM2 | 2021-07-02T10:18:55: PM2 log: App name:sampleapp id:0 disconnected
PM2 | 2021-07-02T10:18:55: PM2 log: App [sampleapp:0] exited with code [0] via signal [SIGINT]
PM2 | 2021-07-02T10:18:55: PM2 log: pid=43140 msg=process killed
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the report using the ecosystem.config.js example, a NextJS app, and its package.json, then run the listed pm2 start command followed by pm2 list. Trace how pm2 list obtains the displayed version and make it show the app's package.json version instead of 0.37.0; verify the corrected table output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nextjs, nodejs
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100