[Question] Properly support nvm for Windows
Open
Nobody has claimed this yet.
S: Open for PR
- Dominant language
- JavaScript
- Stars
- 43.3k
- Forks
- 2.7k
- PR merge metrics
- No merged PRs in 30d
Description
What's going wrong?
pm2 does not properly support nvm for Windows
Specifically:
pm2does not detect the enviromnent variable used bynvmfor Windowspm2does not detect the correct path to wherenvmfor Windows keeps thenodeversions
How could we reproduce this issue?
- Install
nvmfor Windows - Install a
nodeversion withnvm - Try to run an app using
--interpreter node@x.x.x
Supporting information
$ pm2 report
[2018-06-26 14:55:39] PM2 log: ===============================================================================
[2018-06-26 14:55:39] PM2 log: --- New PM2 Daemon started ----------------------------------------------------
[2018-06-26 14:55:39] PM2 log: Time : Tue Jun 26 2018 14:55:39 GMT+0300 (GTB Daylight Time)
[2018-06-26 14:55:39] PM2 log: PM2 version : 2.10.4
[2018-06-26 14:55:39] PM2 log: Node.js version : 6.14.3
[2018-06-26 14:55:39] PM2 log: Current arch : x64
[2018-06-26 14:55:39] PM2 log: PM2 home : C:\Users\%user%\.pm2
[2018-06-26 14:55:39] PM2 log: PM2 PID file : C:\Users\%user%\.pm2\pm2.pid
[2018-06-26 14:55:39] PM2 log: RPC socket file : \\.\pipe\rpc.sock
[2018-06-26 14:55:39] PM2 log: BUS socket file : \\.\pipe\pub.sock
[2018-06-26 14:55:39] PM2 log: Application log path : C:\Users\%user%\.pm2\logs
[2018-06-26 14:55:39] PM2 log: Process dump file : C:\Users\%user%\.pm2\dump.pm2
[2018-06-26 14:55:39] PM2 log: Concurrent actions : 2
[2018-06-26 14:55:39] PM2 log: SIGTERM timeout : 1600
[2018-06-26 14:55:39] PM2 log: ===============================================================================
[2018-06-26 14:55:40] PM2 log: Starting execution sequence in -fork mode- for app name:app1 id:0
[2018-06-26 14:55:40] PM2 error: Error: spawn C:\Users\%user%\AppData\Roaming\nvm\versions\node\v6.14.3\bin\node ENOENT
at exports._errnoException (util.js:1020:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:197:32)
at onErrorNT (internal/child_process.js:376:16)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickDomainCallback (internal/process/next_tick.js:128:9)
[2018-06-26 14:55:40] PM2 log: Starting execution sequence in -fork mode- for app name:app2 id:1
[2018-06-26 14:55:40] PM2 error: Error: spawn C:\Users\%user%\AppData\Roaming\nvm\versions\node\v6.14.3\bin\node ENOENT
at exports._errnoException (util.js:1020:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:197:32)
at onErrorNT (internal/child_process.js:376:16)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickDomainCallback (internal/process/next_tick.js:128:9)
[2018-06-26 14:55:43] PM2 log: App name:app1 id:0 online
[2018-06-26 14:55:43] PM2 log: App name:app2 id:1 online
- sensitive info has been obscured
Are you willing to support nvm for Windows? If so I can provide a PR with the necessary changes.
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
Start by reproducing the issue on Windows with nvm-windows, a Node version, and pm2 ... --interpreter node@x.x.x; use pm2 report to confirm the detected environment and path. Trace the interpreter-resolution entry point, then verify that the nvm-windows environment variable and Node installation path are detected correctly and the app starts successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100