nvs
nvs copied to clipboard
npm commands don't work using git bash on windows after "link"
Steps to Reproduce:
- Follow the Git Bash on Windows instructions for installation
- Install a node version (I installed v10.15.1 through the initial setup by calling
nvs
) - Setup the version as default with "link" (I used
nvs link 10.15.1
) - In a new Bash shell, run
npm -v
Expected result:
- You should see the installed npm version
Actual result:
- got the below error:
$ npm -v
internal/modules/cjs/loader.js:583
throw err;
^
Error: Cannot find module 'C:\Program Files\Git\Users\{username}\AppData\Local\nvs\default\node_modules\npm\bin\npm-cli.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
I found when I inspected PATH
in this shell, the path to the nvs/default
folder was a windows-style path, not a POSIX path.
I was able to get this working locally by changing the entry in my .bashrc
to:
export NVS_HOME=`cygpath "$LOCALAPPDATA/nvs"`
. $NVS_HOME/nvs.sh
Got the same issue and the change with cygpath
also fixed it for me.