nvm: nvm is not compatible with the npm config "prefix" option: currently set to "/usr/local" Run `npm config delete prefix` or `nvm use --delete-prefix v6.10.1 --silent` to unset it.

  • Operating system and version: macOS high sierra version 10.13.1
  • nvm debug output:
nvm --version: v0.33.11
$TERM_PROGRAM: Apple_Terminal
$SHELL: /bin/bash
$SHLVL: 1
$HOME: /Users/Tahshara
$NVM_DIR: '$HOME/.nvm'
$PATH: /usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
$PREFIX: ''
$NPM_CONFIG_PREFIX: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin17)'
uname -a: 'Darwin 17.2.0 Darwin Kernel Version 17.2.0: Fri Sep 29 18:27:05 PDT 2017; root:xnu-4570.20.62~3

  • nvm ls output:
        v6.10.0
        v6.10.1
        v8.11.3
        v10.8.0
->       system
default -> 6.10.1 (-> v6.10.1)
node -> stable (-> v10.8.0) (default)
stable -> 10.8 (-> v10.8.0) (default)
iojs -> N/A (default)
lts/* -> lts/carbon (-> N/A)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.14.4 (-> N/A)
lts/carbon -> v8.12.0 (-> N/A)
  • How did you install nvm? (e.g. install script in readme, Homebrew): I don’t remember. I’ve followed a lot of online documentation.
  • What steps did you perform? idk
  • What happened? idk
  • What did you expect to happen? expected for the nvm install to be successful
  • Is there anything in any of your profile files (.bashrc, .bash_profile, .zshrc, etc) that modifies the PATH?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 34 (13 by maintainers)

Most upvoted comments

Had the same issue, turns out i had separate npm installed system wide. Removing it helped.

I spent a few hours to figure out hot to do it on my Mac Mini

  • delete any installed node except of the nvm https://stackabuse.com/how-to-uninstall-node-js-from-mac-osx/
  • edit ~/.zshrc nano ~/.zshrc and delete lines with export NVM_DIR... and any other which contains $NVM_DIR
  • install nvm again curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash
  • check node nvm --version
  • if not found install it
  • Install the latest LTS version with nvm install --lts
  • use the latest LTS version with nvm use --lts

Profit

We had issues with this setup in Mac OSX with node installed with homebrew. Uninstalling it from brew and using only the nvm version solved our issue. brew uninstall node

I couldn’t get anything here to work, so I “solved” this issue for myself by adding unset PREFIX to .bashrc before nvm does its initial check. 😂

unset PREFIX
export NVM_DIR="$HOME/.config/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

In addition to uninstalling node installed via brew as per above, I had to remove the node_modules folder from my brew lib directory, which had globally installed npm. \o/

Because global modules must be reinstalled and recompiled separately for each node version - so each node version has its own global root.

Sorry, I can’t set aside time to dig into Bash code any more than I have. Since I’ve figured out this issue, I have to decline. 😢

@zkochan thankfully the above comment means that pnpm is fine 😄 which I’m glad to hear.

It had nothing to do with PNPM in the end. 😆 It was /usr/local/bin/npm causing the fuss. (not sure how it got there)

Should NVM use readlink "$(which npm)" to know if NVM is linked correctly? And then give a really useful error message. 😉

@ljharb I did not look into this issue yet but if something needs to be fixed on pnpm side, we will definitely work on it.

Had the same issue, turns out i had separate npm installed system wide. Removing it helped.

How do I do that (finding out if there’s a separate NPM installation and remove it)? ^^"

@aleclarson I’d be happy to accept a PR that gives a better error message in a posix-compliant way 😄

Removing the prefix= from my ~/.npmrc seems to have fixed it for me. 🎉

See here: https://github.com/creationix/nvm/issues/1923#issuecomment-437603289