nvm: Error message: `nvm is not compatible with the npm config "prefix" option: currently set to "/opt/homebrew"`

Operating system and version:

nvm debug output:

nvm --version: v0.36.0
$SHELL: /bin/zsh
$SHLVL: 2
whoami: 'samholmes'
${HOME}: /Users/samholmes
${NVM_DIR}: '${HOME}/.nvm'
${PATH}: /opt/homebrew/bin:/opt/homebrew/sbin:${HOME}/.deno/bin:/usr/local/sbin:${HOME}/bin:/opt/homebrew/bin:/opt/homebrew/sbin:${HOME}/.deno/bin:/usr/local/sbin:${HOME}/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/Library/Apple/usr/bin:${HOME}/.cargo/bin:/Applications/kitty.app/Contents/MacOS:/usr/local/bin:${HOME}/Library/Android/sdk/emulator:${HOME}/Library/Android/sdk/tools:${HOME}/Library/Android/sdk/tools/bin:${HOME}/Library/Android/sdk/platform-tools:/opt/homebrew/bin:${HOME}/Library/Android/sdk/emulator:${HOME}/Library/Android/sdk/tools:${HOME}/Library/Android/sdk/tools/bin:${HOME}/Library/Android/sdk/platform-tools
$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: Wed Aug 10 14:28:23 PDT 2022; root:xnu-8020.141.5~2/RELEASE_ARM64_T6000 arm64'
checksum binary: 'shasum'
OS version: macOS 12.5.1 21G83
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: /bin/rm
mkdir: /bin/mkdir
xargs: /usr/bin/xargs
git: /usr/bin/git, git version 2.32.1 (Apple Git-133)
grep: /usr/bin/grep, grep (BSD grep, GNU compatible) 2.6.0-FreeBSD
awk: /usr/bin/awk, awk version 20200816
nvm current: system
which node: /opt/homebrew/bin/node
which iojs: iojs not found
which npm: /opt/homebrew/bin/npm
npm config get prefix: /opt/homebrew
npm root -g: /opt/homebrew/lib/node_modules

nvm ls output:

       v10.23.0
       v12.19.0
       v14.15.0
       v14.17.5
       v16.15.1
->       system
default -> lts/* (-> v16.15.1)
node -> stable (-> v16.15.1) (default)
stable -> 16.15 (-> v16.15.1) (default)
iojs -> N/A (default)
unstable -> N/A (default)
lts/* -> lts/gallium (-> v16.15.1)
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.19.3 (-> N/A)
lts/gallium -> v16.15.1

How did you install nvm?

install script in readme

What steps did you perform?

  1. Open terminal app
  2. Open a sub-shell with zsh
  3. Run nvm ls

What happened?

On step 2, an error message appears:

nvm is not compatible with the npm config "prefix" option: currently set to "/opt/homebrew"
Run `npm config delete prefix` or `nvm use --delete-prefix v16.15.1 --silent` to unset it.
Make sure your username (samholmes) matches the one in your $HOME path.
See the "macOS Troubleshooting" section in the docs for more information.

And, on step 3, the selected node version is system.

What did you expect to happen?

No message is shown when the sub-shell starts and the selected node version should be v16.15.1.

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

  • .zshrc
  • .zshenv
  • .cargo/env

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 6
  • Comments: 21 (10 by maintainers)

Most upvoted comments

I did brew uninstall node and now nvm will always take precedent over “system” because /opt/homebrew/bin (in the path) does not contain a node bin