nvm debug output:nvm --version: v0.32.1
$SHELL: /bin/zsh
$HOME: /Users/jiehuang
$NVM_DIR: '$HOME/.nvm'
$PREFIX: ''
$NPM_CONFIG_PREFIX: ''
nvm current: system
which node: /usr/local/bin/node
which iojs: iojs not found
which npm: /usr/local/bin/npm
npm config get prefix: $HOME/.npm-global
npm root -g: $HOME/.npm-global/lib/node_modules
nvm ls output: v4.7.0
-> system
default -> v4.7.0
node -> stable (-> v4.7.0) (default)
stable -> 4.7 (-> v4.7.0) (default)
iojs -> N/A (default)
lts/* -> lts/boron (-> N/A)
lts/argon -> v4.7.0
lts/boron -> v6.9.2 (-> N/A)
How did you install nvm? (e.g. install script in readme, homebrew):
zsh-nvm
https://github.com/lukechilds/zsh-nvm
What steps did you perform?
What happened?
everytime when I run nvm command , it shows warning message:
nvm is not compatible with the npm config "prefix" option: currently set to "/Users/jiehuang/.npm-global"
Run `npm config delete prefix` or `nvm use --delete-prefix v4.7.0` to unset it.
What did you expect to happen?
Is there anything in any of your profile files (.bashrc, .bash_profile, .zshrc, etc) that modifies the PATH?
@williamjieh do you have a ~/.npmrc file that has a "prefix" set in it? If not, what does env | grep -i prefix print out?
@ljharb I don't have ~/.npmrc file, the env | grep -i prefix command print out nothing.
and I tried command nvm use --delete-prefix v4.7.0 , now nvm looks work properly, but every time when I open a new tab in terminal, this will print out:
awk: i/o error occurred while closing /dev/stdin
source line number 8
Are you using oh-my-zsh, by chance? If so, what does setopt print out?
Yes, I'm using oh-my-zsh. setopt print out:
alwaystoend
autocd
autopushd
completeinword
extendedhistory
noflowcontrol
histexpiredupsfirst
histignoredups
histignorespace
histverify
incappendhistory
interactive
interactivecomments
login
longlistjobs
monitor
nonomatch
promptsubst
pushdignoredups
pushdminus
sharehistory
shinstdin
zle
oh-my-zsh's options break a lot of things, sadly.
The options I have set on my stock zsh install are:
combiningchars
interactive
monitor
nonomatch
shinstdin
zle
This means that the following are enabled on yours but not mine (and combiningchars is disabled on yours, but not mine):
alwaystoend
autocd
autopushd
completeinword
extendedhistory
noflowcontrol
histexpiredupsfirst
histignoredups
histignorespace
histverify
incappendhistory
interactivecomments
login
longlistjobs
promptsubst
pushdignoredups
pushdminus
sharehistory
I'm afraid the only way to make progress here is for you to systematically disable these options until we can figure out which option(s) are causing breakage. You'll need to re-source nvm.sh after any of the option changes, just in case.
@williamjieh Do you have something like export NVM_DIR="~/.nvm" in your .zshrc?
I just stumbled upon this issue and apparently NVM didn鈥檛 like that ~. The solution was to export NVM_DIR=$(cd ~/.nvm && pwd -P).
(I am on macOS 10.12.2)
Most helpful comment
@williamjieh Do you have something like
export NVM_DIR="~/.nvm"in your.zshrc?I just stumbled upon this issue and apparently NVM didn鈥檛 like that
~. The solution was toexport NVM_DIR=$(cd ~/.nvm && pwd -P).(I am on macOS 10.12.2)