nvm: nvm install fails complaining about prefix, despite not being set
I am on a linux (ubuntu) machine, just getting started with nvm. (removed all prior installations of node, npm, and n)
$ nvm install stable
Downloading https://nodejs.org/dist/v6.1.0/node-v6.1.0-linux-x64.tar.xz...
######################################################################## 100.0%
nvm is not compatible with the npm config "prefix" option: currently set to "/home/dominic/Github/dominicbarnes/dotfiles/nvm/versions/node/v6.1.0"
Run `nvm use --delete-prefix v6.1.0` to unset it.
I’ve seen this documented around in the readme, and I read the related tickets. However, I did not set any custom prefix at any point. The instructions it gives work for the time, but the error shows right back up for each new terminal session.
I suspect this is because I don’t have any version of node/npm installed at the system level, so whatever is trying to look for the broken prefix value may be getting unexpected behavior, but I’m not sure. (see next comment below, I think I’ve ruled this out)
The prefix option that nvm reports to me appears to be generated on it’s own, as I don’t have a $PREFIX or $NPM_CONFIG_PREFIX option anywhere in my env. (nor is there a profile=... in my ~/.npmrc)
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 24 (9 by maintainers)
Commits related to this issue
- Work around long-standing annoying nvm bug It only shows up on one machine, where I have /home symlinked to a different mount point. creationix/nvm#855 creationix/nvm#1087 creationix/nvm#1224 creati... — committed to drewr/dotfiles by drewr 7 years ago
- Work around long-standing annoying nvm bug It only shows up on one machine, where I have /home symlinked to a different mount point. creationix/nvm#855 creationix/nvm#1087 creationix/nvm#1224 creati... — committed to drewr/dotfiles by drewr 7 years ago
- Work around long-standing annoying nvm bug It only shows up on one machine, where I have /home symlinked to a different mount point. creationix/nvm#855 creationix/nvm#1087 creationix/nvm#1224 creati... — committed to drewr/dotfiles by drewr 7 years ago
I had this issue for the past week, and I finally sat down and took two hours to fix this. Here is what worked for me:
First of all, I wanted to keep the global node modules. So I ran
npm ls -g --depth 0to list all the main once for reinstallation. Just copy and paste the list to a text editor.Then it was about removing all traces of NVM, Node, and NPM:
Then I used https://github.com/lukechilds/zsh-nvm to install NVM again (I am using Oh-My-ZSH).
Next step, installing the latest Node version that I wanted
nvm install --ltsand followed by that I set the defaultnvm alias defaultand then installed my global packages again.I finally have a system that’s working again and not nagging me about this damn PREFIX thing 👍 .
Ah. Yes, that’s the problem.
nvmdoes not currently work with symlinks. (related, #617 and https://github.com/creationix/nvm/issues/1031#issuecomment-194044829)@rauliyohmc it’s likely because
$HOMEhasRauliyohmc, andnpm config get prefixis reportingrauliyohmc. One possible fix is to lowercase your username - are you on a case-insensitive filesystem?@p4ali
nvmis not supported via homebrew (as the homebrew formula indicates).brew uninstall nvm, and then properly installnvmwith the curl script in the readme, and your problem should go away.That was it @ljharb, thanks a lot 🤖