nvm: Minor issue: `nvm current` returns blank/nothing on Windows w/ Git Bash environment
Operating system and version:
Windows 10, nvm version 0.39.1
nvm debug
output:
$ nvm debug
nvm --version: v0.39.1
$SHELL: /usr/bin/bash
$SHLVL: 1
whoami: 'jschilling'
${HOME}: /c/Users/jschilling
${NVM_DIR}: '${HOME}/.nvm'
${PATH}: ${HOME}/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:${HOME}/bin:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Windows/System32/OpenSSH:/c/Program Files (x86)/Microsoft SQL Server/150/DTS/Binn:/c/Program Files/Azure Data Studio/bin:/c/Program Files/dotnet:/c/Windows/system32/config/systemprofile/.dnx/bin:/c/Program Files/Microsoft DNX/Dnvm:/c/Program Files/Microsoft SQL Server/130/Tools/Binn:/c/Program Files/Microsoft/Web Platform Installer:/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/cmd:${HOME}/AppData/Local/Programs/Microsoft VS Code/bin:${HOME}/AppData/Local/.meteor:${NVM_DIR}/versions/node/v12.19.1/bin/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:${NVM_DIR}/versions/node/v12.19.1/bin/node_modules/meteor/node_modules/.bin:${NVM_DIR}/versions/node/v12.19.1/bin/node_modules/.bin:${NVM_DIR}/versions/node/v12.19.1/bin:${HOME}/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/usr/bin:/mingw64/bin:/usr/bin:${HOME}/bin:${HOME}/.dnx/bin:/c/Program Files/Microsoft SQL Server/130/Tools:/usr/bin/vendor_perl:/usr/bin/core_perl
$PREFIX: ''
${NPM_CONFIG_PREFIX}: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'GNU bash, version 5.2.15(1)-release (x86_64-pc-msys)'
uname -a: 'MINGW64_NT-10.0-19045 3.4.7-ea781829.x86_64 2023-07-05 12:05 UTC x86_64 Msys'
checksum binary: 'sha256sum'
curl: /mingw64/bin/curl, curl 8.1.2 (x86_64-w64-mingw32) libcurl/8.1.2 Schannel zlib/1.2.13 brotli/1.0.9 zstd/1.5.5 libidn2/2.3.4 libpsl/0.21.2 (+libidn2/2.3.3) libssh2/1.11.0
wget: not found
git: /mingw64/bin/git, git version 2.41.0.windows.3
grep: /usr/bin/grep, grep (GNU grep) 3.0
awk: /usr/bin/awk, GNU Awk 5.0.0, API: 2.0 (GNU MPFR 4.2.0-p9, GNU MP 6.2.1)
sed: /usr/bin/sed, sed (GNU sed) 4.9
cut: /usr/bin/cut, cut (GNU coreutils) 8.32
basename: /usr/bin/basename, basename (GNU coreutils) 8.32
rm: /usr/bin/rm, rm (GNU coreutils) 8.32
mkdir: /usr/bin/mkdir, mkdir (GNU coreutils) 8.32
xargs: /usr/bin/xargs, xargs (GNU findutils) 4.9.0
nvm current:
which node: ${NVM_DIR}/versions/node/v12.19.1/bin/node
which iojs: which: no iojs in (${HOME}/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:${HOME}/bin:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Windows/System32/OpenSSH:/c/Program Files (x86)/Microsoft SQL Server/150/DTS/Binn:/c/Program Files/Azure Data Studio/bin:/c/Program Files/dotnet:/c/Windows/system32/config/systemprofile/.dnx/bin:/c/Program Files/Microsoft DNX/Dnvm:/c/Program Files/Microsoft SQL Server/130/Tools/Binn:/c/Program Files/Microsoft/Web Platform Installer:/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/cmd:${HOME}/AppData/Local/Programs/Microsoft VS Code/bin:${HOME}/AppData/Local/.meteor:${NVM_DIR}/versions/node/v12.19.1/bin/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:${NVM_DIR}/versions/node/v12.19.1/bin/node_modules/meteor/node_modules/.bin:${NVM_DIR}/versions/node/v12.19.1/bin/node_modules/.bin:${NVM_DIR}/versions/node/v12.19.1/bin:${HOME}/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/usr/bin:/mingw64/bin:/usr/bin:${HOME}/bin:${HOME}/.dnx/bin:/c/Program Files/Microsoft SQL Server/130/Tools:/usr/bin/vendor_perl:/usr/bin/core_perl)
which npm: ${NVM_DIR}/versions/node/v12.19.1/bin/npm
npm config get prefix: C:\Users\jschilling\.nvm\versions\node\v12.19.1\bin
npm root -g: C:\Users\jschilling\.nvm\versions\node\v12.19.1\bin\node_modules
nvm ls
output:
$ nvm ls
v12.19.1
v12.20.2
v16.17.0
v18.13.0
system
default -> 18.13.0 (-> v18.13.0)
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v18.13.0) (default)
stable -> 18.13 (-> v18.13.0) (default)
lts/* -> lts/hydrogen (-> N/A)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.24.1 (-> N/A)
lts/erbium -> v12.22.12 (-> N/A)
lts/fermium -> v14.21.3 (-> N/A)
lts/gallium -> v16.20.0 (-> N/A)
lts/hydrogen -> v18.16.0 (-> N/A)
How did you install nvm
?
From the install script in the readme
What steps did you perform?
- Installed nvm
- Added a .nvmrc file to our projects
- Installed the required versions of Node with nvm for each of our projects
- We have been using nvm for a long time now with little to no issue across our Windows and MacOS environments
What happened?
Nvm and the node versions installed as expected, however running the nvm current
command returns nothing/blank in a Windows 10 & Git Bash environment. It even returns blank in the nvm debug
results posted above.
Also nvm list
and nvm ls
don’t notate the currently selected version of Node from the list of installed versions.
What did you expect to happen?
Similar to how it operates in our MacOS environments, I would expect nvm current
to show the currently selected Node version and nvm list
and nvm ls
to notate the currently selected Node version from the list of installed versions.
Is there anything in any of your profile files that modifies the PATH
?
Not that I can see. The .bashrc
file alters the NVM_DIR variable and exports it but that is all.
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 15 (7 by maintainers)
interesting, thanks. i’ll see what’s achievable there, since it’d have to be done only for git bash
Indeed, versions shouldn’t be hardcoded like that.
I haven’t had a chance to look into this yet, but it’s clearly a Windows-specific bug that needs fixing. If someone beats me to it, I’d love to review a PR.
The output from the requested command is:
Thanks, that’s helpful. What about
nvm_tree_contains_path ${NVM_DIR} $(command which node) ; echo $?
?