nvm: Cannot install node on macOS

Operating system and version:

nvm debug output:

nvm --version: v0.39.2
$SHELL: /bin/zsh
$SHLVL: 1
whoami: 'kret'
${HOME}: /Users/kret
${NVM_DIR}: '${HOME}/.nvm'
${PATH}: ${HOME}/.nix-profile/bin:${HOME}/.opam/default/bin:${HOME}/.rbenv/shims:${NVM_DIR}/versions/node/v18.10.0/bin:${HOME}/.jenv/shims:${HOME}/.asdf/shims:/usr/local/opt/asdf/libexec/bin:${HOME}/bin:${HOME}/.cabal/bin:${HOME}/.ghcup/bin:${HOME}/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin
$PREFIX: ''
${NPM_CONFIG_PREFIX}: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'zsh 5.8.1 (x86_64-apple-darwin21.0)'
uname -a: 'Darwin 21.6.0 Darwin Kernel Version 21.6.0: Mon Aug 22 20:17:10 PDT 2022; root:xnu-8020.140.49~2/RELEASE_X86_64 x86_64'
checksum binary: 'sha256sum'
OS version: macOS 12.6 21G115
curl: /usr/bin/curl, curl 7.79.1 (x86_64-apple-darwin21.0) libcurl/7.79.1 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.11 nghttp2/1.45.1
wget: not found
sed: /usr/bin/sed
cut: /usr/bin/cut
basename: /usr/bin/basename
rm: rm: aliased to rm -i (rm -i)
mkdir: /bin/mkdir
xargs: /usr/bin/xargs
git: /usr/local/bin/git, git version 2.38.1
ls: grep:: No such file or directory
grep: grep: aliased to grep --color (grep --color), grep (BSD grep, GNU compatible) 2.6.0-FreeBSD
awk: /usr/bin/awk, awk version 20200816
nvm current: v18.10.0
which node: ${NVM_DIR}/versions/node/v18.10.0/bin/node
which iojs: iojs not found
which npm: ${NVM_DIR}/versions/node/v18.10.0/bin/npm
npm config get prefix: ${NVM_DIR}/versions/node/v18.10.0
npm root -g: ${NVM_DIR}/versions/node/v18.10.0/lib/node_modules

nvm ls output:

       v16.13.1
->     v18.10.0
         system
default -> node (-> v18.10.0)
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v18.10.0) (default)
stable -> 18.10 (-> v18.10.0) (default)
lts/* -> lts/gallium (-> 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.20.1 (-> N/A)
lts/gallium -> v16.18.0 (-> N/A)

How did you install nvm?

Install script in readme, v0.35.1, kept updated via zsh-nvm plugin.

What steps did you perform?

Ran nvm install node --reinstall-packages-from=node and instead of usual installation of node a very long error output was displayed (see next section). Same thing happened when using other recent node version numbers: 16, 17, 18. Also when I removed the --reinstall-packages-from parameter. Also when I run nvm install -b node.

What happened?

Downloading and installing node v19.0.0...
awk: non-terminated string node-v19.0... at source line 1
 context is
	{ if ("node-v19.0.0-darwin-integer 10 readonly '!'=74621 >>>
 <<<
awk: non-terminated string node-v19.0... at source line 2
awk: non-terminated string node-v19.0... at source line 3
mkdir: /Users/kret/.nvm/.cache/bin/node-v19.0.0-darwin-integer 10 readonly '!'=74621
integer 10 readonly '#'=0
integer 10 readonly '$'=74222
array readonly '*'=(  )
readonly -=3569JNRXghikls
0=nvm_get_arch
integer 10 readonly '?'=0
array readonly @=(  )
local ADDITIONAL_PARAMETERS=''
ALACRITTY_LOG=: File name too long
creating directory /Users/kret/.nvm/.cache/bin/node-v19.0.0-darwin-integer 10 readonly '!'=74621
...
...goes on for maaany lines
...

Eventually requested node version was not installed.

What did you expect to happen?

I expected the requested binary node distribution of Mac OS to be downloaded, installed and made available via nvm, as usually so far.

Is there anything in any of your profile files that modifies the PATH?

In my .zshrc I have at the top: export PATH=$HOME/bin:$HOME/.cabal/bin:$HOME/.ghcup/bin:$HOME/.local/bin:$PATH

If you are having installation issues, or getting “N/A”, what does curl -I --compressed -v https://nodejs.org/dist/ print out?


About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 19 (9 by maintainers)

Most upvoted comments

Agreed. Commenting out common-aliases plugin from .zshrc allows node installation to succeed.

I don’t have common-aliases for a zsh plugin and I’m experiencing the same issue… I use iTerm, but confirmed that Terminal also exhibits the same behavior.

I debugged my .zshrc via un/commenting. It turns out that I had a custom alias for the single character L. Got rid of that it was working properly. Looks like the similar issue talked about L as a problem alias (see https://github.com/nvm-sh/nvm/issues/2963#issuecomment-1336526069)

Unaliasing rm and grep does not help.

Workaround: I disabled the oh-my-zsh in my shell I was able to install new node version using the original command.

Ok, thanks for confirming!

it’s possible this is related to #2914, and will be fixed in the next release.