nvm
nvm copied to clipboard
Alias bypassing issue in GitBash
Operating system and version:
Windows 11
nvm debug
output:
❯ nvm debug
nvm --version: v0.39.0
$SHELL: /usr/bin/bash
$SHLVL: 1
whoami: 'trajano'
${HOME}: /c/Users/trajano
${NVM_DIR}: '${HOME}/.nvm'
${PATH}: ${HOME}/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/c/ProgramData/scoop/apps/zulu12/current/bin:/c/ProgramData/scoop/shims:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Windows/System32/OpenSSH:/c/ProgramData/chocolatey/bin:/c/Program Files/dotnet:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/WINDOWS/System32/OpenSSH:/cmd:/c/Program Files (x86)/Microsoft Emulator Manager/1.0:/c/Program Files/Docker/Docker/resources/bin:/c/ProgramData/DockerDesktop/version-bin:${HOME}/scoop/apps/python/current/Scripts:${HOME}/scoop/apps/python/current/:${HOME}/scoop/apps/imagemagick/current/:${HOME}/scoop/apps/python/current:${HOME}/scoop/apps/zulu12/current/bin:${HOME}/scoop/shims:${HOME}/AppData/Local/Microsoft/WindowsApps:${HOME}/AppData/Local/Programs/Microsoft VS Code/bin:/c/Program Files (x86)/GitHub CLI:${HOME}/AppData/Local/Microsoft/WindowsApps:/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 4.4.23(1)-release (x86_64-pc-msys)'
uname -a: 'MSYS_NT-10.0-22000 3.1.7-340.x86_64 2021-10-12 16:29 UTC x86_64 Msys'
checksum binary: ''
curl: not found
wget: not found
git: not found
grep: not found
awk: not found
sed: not found
cut: not found
basename: not found
rm: not found
mkdir: not found
xargs: not found
nvm current: none
which node: which: no node in (${HOME}/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/c/ProgramData/scoop/apps/zulu12/current/bin:/c/ProgramData/scoop/shims:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Windows/System32/OpenSSH:/c/ProgramData/chocolatey/bin:/c/Program Files/dotnet:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/WINDOWS/System32/OpenSSH:/cmd:/c/Program Files (x86)/Microsoft Emulator Manager/1.0:/c/Program Files/Docker/Docker/resources/bin:/c/ProgramData/DockerDesktop/version-bin:${HOME}/scoop/apps/python/current/Scripts:${HOME}/scoop/apps/python/current/:${HOME}/scoop/apps/imagemagick/current/:${HOME}/scoop/apps/python/current:${HOME}/scoop/apps/zulu12/current/bin:${HOME}/scoop/shims:${HOME}/AppData/Local/Microsoft/WindowsApps:${HOME}/AppData/Local/Programs/Microsoft VS Code/bin:/c/Program Files (x86)/GitHub CLI:${HOME}/AppData/Local/Microsoft/WindowsApps:/usr/bin/vendor_perl:/usr/bin/core_perl)
which iojs: which: no iojs in (${HOME}/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/c/ProgramData/scoop/apps/zulu12/current/bin:/c/ProgramData/scoop/shims:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Windows/System32/OpenSSH:/c/ProgramData/chocolatey/bin:/c/Program Files/dotnet:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/WINDOWS/System32/OpenSSH:/cmd:/c/Program Files (x86)/Microsoft Emulator Manager/1.0:/c/Program Files/Docker/Docker/resources/bin:/c/ProgramData/DockerDesktop/version-bin:${HOME}/scoop/apps/python/current/Scripts:${HOME}/scoop/apps/python/current/:${HOME}/scoop/apps/imagemagick/current/:${HOME}/scoop/apps/python/current:${HOME}/scoop/apps/zulu12/current/bin:${HOME}/scoop/shims:${HOME}/AppData/Local/Microsoft/WindowsApps:${HOME}/AppData/Local/Programs/Microsoft VS Code/bin:/c/Program Files (x86)/GitHub CLI:${HOME}/AppData/Local/Microsoft/WindowsApps:/usr/bin/vendor_perl:/usr/bin/core_perl)
which npm: which: no npm in (${HOME}/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/c/ProgramData/scoop/apps/zulu12/current/bin:/c/ProgramData/scoop/shims:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Windows/System32/OpenSSH:/c/ProgramData/chocolatey/bin:/c/Program Files/dotnet:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/WINDOWS/System32/OpenSSH:/cmd:/c/Program Files (x86)/Microsoft Emulator Manager/1.0:/c/Program Files/Docker/Docker/resources/bin:/c/ProgramData/DockerDesktop/version-bin:${HOME}/scoop/apps/python/current/Scripts:${HOME}/scoop/apps/python/current/:${HOME}/scoop/apps/imagemagick/current/:${HOME}/scoop/apps/python/current:${HOME}/scoop/apps/zulu12/current/bin:${HOME}/scoop/shims:${HOME}/AppData/Local/Microsoft/WindowsApps:${HOME}/AppData/Local/Programs/Microsoft VS Code/bin:/c/Program Files (x86)/GitHub CLI:${HOME}/AppData/Local/Microsoft/WindowsApps:/usr/bin/vendor_perl:/usr/bin/core_perl)
npm config get prefix: bash: npm: command not found
npm root -g: bash: npm: command not found
nvm ls
output:
N/A
iojs -> N/A (default)
node -> stable (-> N/A) (default)
unstable -> N/A (default)
How did you install nvm
?
❯ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
=> Downloading nvm from git to '/c/Users/trajano/.nvm'
=> Cloning into 'C:/Users/trajano/.nvm'...
remote: Enumerating objects: 349, done.
remote: Counting objects: 100% (349/349), done.
remote: Compressing objects: 100% (298/298), done.
Recei )
Receiving objects: 100% (349/349), 201.96 KiB | 1.22 MiB/s, done.
Resolving deltas: 100% (39/39), done.
* (HEAD detached at FETCH_HEAD)
master
=> Compressing and cleaning up git repository
=> nvm source string already in /c/Users/trajano/.bash_profile
=> bash_completion source string already in /c/Users/trajano/.bash_profile
=> Close and reopen your terminal to start using nvm or run the following to use it now:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
What steps did you perform?
What happened?
it can't find curl
or wget
What did you expect to happen?
Is there anything in any of your profile files that modifies the PATH
?
If you are having installation issues, or getting "N/A", what does curl -I --compressed -v https://nodejs.org/dist/
print out?
I also tried using master
and it does not work.
Found the reason. I aliased type
because I'm on Windows and I was used to type
as an alias to cat
perhaps the nvm_type
should use builtin type
instead
nvm_type should use command type
which bypasses alias. Perhaps alias bypassing doesn’t work in git bash? If so we’ll have to look into if there’s a way to fix that.
if you modify your windows test to add the following
alias type=cat
you should get the issue.
Also the way you may be implementing things may be incorrect. For example you have nvm_cd
as \cd
that would work in most cases, but really it should be builtin cd
like builtin type
Is builtin
in POSIX? I've been using command
for most things, which works in most everything, altho there's at least one case where zsh requires \
and only that.
command
is the more standard one I think. I know bash
uses builtin
nvm supports ksh, dash, sh, bash, and zsh, so we can’t rely on bashisms.