lukechilds / zsh-nvm

Zsh plugin for installing, updating and loading nvm
MIT License
2.22k stars 112 forks source link

Make npm prefix working #65

Closed weilbith closed 4 years ago

weilbith commented 4 years ago

I have the following npm configuration to make it conform with the XDG basedir specification:

prefix=${XDG_DATA_HOME}/npm
cache=${XDG_CACHE_HOME}/npm
tmp=${XDG_RUNTIME_DIR}/npm
init-module=${XDG_CONFIG_HOME}/npm/config/npm-init.js

I set the $NPM_CONFIG_USERCONFIG environment variable to $XDG_CONFIG_HOME/npm/npmrc to load the above content. Furthermore I set $NVM_DIR to $XDG_DATA_HOME/nvm.

I get some errors for nvm use (enabled $NVM_AUTO_USE). I think the reason becomes clear when I call nvm install v12. Which brings the following output:

v12.16.3 is already installed.
nvm is not compatible with the npm config "prefix" option: currently set to "/home/thore/.local/share/npm"
Run `npm config delete prefix` or `nvm use --delete-prefix v12.16.3` to unset it.

I'm not sure what the suggested solutions do in detail. I really want to keep my documentation. Is this possible?

lukechilds commented 4 years ago

It doesn't look like this issue is related to zsh-nvm.

Is there a reason you think it is?

weilbith commented 4 years ago

You mean I should direct it to nvm directly?

lukechilds commented 4 years ago

Yeah, unless you think there's it's something that zsh-nvm is doing that's causing the issue.