nvs
nvs copied to clipboard
npm doesn't work in Git Bash for a linked node.js version
Repro steps:
- Install nvs v1.6.0 via MSI installer for a current user.
- Setup for Git Bash as per Git Bash on Windows.
- Using Git Bash add node.js 8.17.0, use it and link it as a default (any other version also fails).
- Relaunch Git Bash, check whether
node
andnpm
works:
Expected result:
-
node -v
outputsv8.17.0
-
npm -v
outputsv6.13.4
Actual result:
-
node -v
outputsv8.17.0
-
npm -v
outputs:
module.js:550
throw err;
^
Error: Cannot find module 'C:\Program Files\Git\Users\ovchinnikov\AppData\Local\nvs\default\node_modules\npm\bin\npm-cli.js'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3
Environment
Windows x64 20H2 nvs v1.6.0
~/.bashrc
contents:
export NVS_HOME=$LOCALAPPDATA/nvs
. $NVS_HOME/nvs.sh
~/.bash_profile
contents:
if [ -f ~/.bashrc ]; then . ~/.bashrc; fi
The same use case works fine for Command Prompt and Powershell.
do you @jasongin have any suggestion on this? I found that the main cause behind gitbash/mingw issues is that nvs detects windows platform first and does not anticipate any bash shell anymore. If my assumption is right, I'm happy to open a PR for this.
https://github.com/jasongin/nvs/blob/0b7279943e1b5a81db6721d71e986a1259907f61/lib/install.js#L20-L44
There is a functional test that runs in the CI that is intended to validate operations within git bash on Windows, including npm
:
https://github.com/jasongin/nvs/blob/master/test/cli/gitBashTests.js
Do you know if that test is not validating enough or not validating correctly? Or is there something different about how that runs compared to your environment?
I don't have much time to work on this, and I don't normally use git bash day to day. So if you do have a solution, a PR would be welcome!
@jasongin @Deilan could you please check my pr? GH does not allow me to add reviewers. Thanks for comments in advance
Is there any update on this issue? We cannot use NVS because Link does not work for NPM on Git Bash.
This has to be a joke