Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'nvm is not compatible with the npm config "prefix" option' message in every shell #1224

Closed
sersorrel opened this issue Sep 12, 2016 · 3 comments
Labels
needs followup We need some info or action from whoever filed this issue/PR.

Comments

@sersorrel
Copy link

Every time I open a shell (I have default aliased to node), the following message is printed:

nvm is not compatible with the npm config "prefix" option: currently set to "/home/josh/.local/share/nvm/versions/node/v4.5.0"
Run `nvm use --delete-prefix v4.5.0 --silent` to unset it.

I don't understand why this appears, as I don't have node installed globally and doing sudo find / -name '*npmrc*' doesn't return anything except the man pages for npm.

After doing nvm use --delete-prefix v4.5.0 --silent, npm config ls -l | grep prefix prints prefix = "/home/josh/.local/share/nvm/versions/node/v4.5.0", so maybe it's something to do with that?

I installed nvm with curl -o- https://raw.github.com/creationix/nvm/v0.31.7/install.sh | NVM_DIR=.local/share/nvm bash, then ran nvm install --lts and nvm alias default node.

@ljharb
Copy link
Member

ljharb commented Sep 12, 2016

What does nvm debug print out? It looks like your NVM_DIR is not $HOME, but is inside $HOME/.local/share/nvm?

@ljharb ljharb added the needs followup We need some info or action from whoever filed this issue/PR. label Sep 12, 2016
@sersorrel
Copy link
Author

$ nvm debug
nvm --version: v0.31.7
$SHELL: /bin/bash
$HOME: /home/josh
$NVM_DIR: '.local/share/nvm'
$PREFIX: ''
$NPM_CONFIG_PREFIX: ''
nvm current: none
which node: 
which iojs: 
which npm: 
npm config get prefix: The program 'npm' is currently not installed. You can install it by typing:
sudo apt install npm
npm root -g: The program 'npm' is currently not installed. You can install it by typing:
sudo apt install npm

I set my $NVM_DIR to .local/share/nvm on install.

I just tried reinstalling without specifying $NVM_DIR, and it seems to work - I got a message from nvm install --lts saying nvm_ensure_default_set: a version is required, but I ran nvm alias default node and it all appears to work.

It actually looks like the problem occurs if $NVM_DIR is not an absolute path; setting it to $HOME/.local/share/nvm works fine.

@ljharb
Copy link
Member

ljharb commented Sep 12, 2016

yes, that's absolutely correct - if it's a relative path then nvm would work or not based on your current directory.

@ljharb ljharb closed this as completed Sep 12, 2016
drewr added a commit to drewr/dotfiles that referenced this issue Feb 25, 2017
drewr added a commit to drewr/dotfiles that referenced this issue Feb 25, 2017
drewr added a commit to drewr/dotfiles that referenced this issue Feb 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs followup We need some info or action from whoever filed this issue/PR.
Projects
None yet
Development

No branches or pull requests

2 participants