Closed fabdrol closed 3 years ago
Thanks for the report! What does nvm deactivate ; nvm debug ; echo $PREFIX ; echo $NPM_CONFIG_PREFIX
print out?
Could not find /Users/Fabian/.nvm/*/bin in $PATH
Could not find /Users/Fabian/.nvm/*/share/man in $MANPATH
$SHELL: /bin/zsh
$NVM_DIR: /Users/Fabian/.nvm
nvm current: none
which node: node not found
which iojs: iojs not found
which npm: npm not found
npm config get prefix: nvm:74: command not found: npm
npm root -g: nvm:74: command not found: npm
and the env vars?
PATH=.:/usr/local:/usr/local/bin:/usr/local/sbin:/usr/local/heroku/bin:/usr/local/mysql/bin:/usr/local/git/bin:/usr/local/mongodb/bin:/usr/bin:/usr/sbin:/usr/local/lib/AIRSDK:/usr/local/lib/AIRSDK/bin:/Users/fabian:/Users/fabian/bin:/Users/fabian/.bin:/Users/fabian/.phpdoc/bin:/Users/fabian/pear/bin:/Users/fabian/.composer/vendor/bin:/Users/fabian/android.ndk:/Users/fabian/android.sdk/r24.3.4:/Users/fabian/android.sdk/r24.3.4/tools:/Volumes/Hyper/Development/Go/bin:/Library/Java/Home/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
TMPDIR=/var/folders/mp/hd4fy3n15z17_g9s4j11y8gm0000gn/T/
LOGNAME=fabian
XPC_FLAGS=0x0
HOME=/Users/fabian
Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.WrQOEzC6ut/Render
TERM=xterm-256color
COLORFGBG=7;0
USER=fabian
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.FEGVlgCDcM/Listeners
ITERM_PROFILE=Default
TERM_PROGRAM=iTerm.app
XPC_SERVICE_NAME=0
SHELL=/bin/zsh
ITERM_SESSION_ID=w0t0p0
PWD=/Users/fabian
__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0
LC_CTYPE=UTF-8
SHLVL=1
OLDPWD=/Users/fabian
ZSH=/Users/fabian/.oh-my-zsh
LANG=en_US.UTF-8
GOPATH=/Volumes/Hyper/Development/Go
NODE_PATH=/usr/local/bin/node
NODE_HOME=/usr/local/lib/node
JAVA_HOME=/Library/Java/Home
ANDROID_SDK=/Users/fabian/android.sdk/r24.3.4
ANDROID_NDK=/Users/fabian/android.ndk
PAGER=less
LESS=-R
LSCOLORS=Gxfxcxdxbxegedabagacad
LS_COLORS=no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:
NVM_DIR=/Users/Fabian/.nvm
NVM_NODEJS_ORG_MIRROR=https://nodejs.org/dist
NVM_IOJS_ORG_MIRROR=https://iojs.org/dist
MANPATH=/usr/share/man:/usr/local/share/man:/usr/local/mysql/man:/Applications/Xcode.app/Contents/Developer/usr/share/man:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man
NVM_PATH=/Users/Fabian/.nvm/versions/node/v0.12.7/lib/node
NVM_BIN=/Users/Fabian/.nvm/versions/node/v0.12.7/bin
_=/usr/bin/printenv
Thanks! so, clearly you don't have an npm prefix set.
Are you by chance using oh-my-zsh
? That tends to set tons of opts
that nvm
has to manually account for.
Yeah, I am.. I could manually set it, I assume? How do I go about that?
If you try to set the "prefix" that will break nvm
.
As a temporary workaround, you can do nvm use --delete-prefix v0.12.7
, but this is a bug specifically with omz
. I'll have to figure out which option to unset when doing the comparison.
Okay, let me know if I can help with anything!
Could you provide the output of setopt
as well? From there I should be able to try to debug it.
alwaystoend
autocd
autopushd
cdablevars
completeinword
extendedhistory
noflowcontrol
histexpiredupsfirst
histignoredups
histignorespace
histverify
incappendhistory
interactive
interactivecomments
login
longlistjobs
nonomatch
promptsubst
pushdignoredups
pushdminus
sharehistory
shinstdin
Thanks! I'll take a look at this asap.
One more thing that could be interesting: this is a brand new installation of El Capitan; I didn't have this issue before on Mavericks (I also used oh my zsh on Mavericks)
Good to know - I don't have an El Capitan machine to test on just yet.
If you have anything else I should test for you, just let me know.
I definitely started noticing these issues after upgrading to El Capitan.
@mikepaggi you're also on zsh
? are you using oh-my-zsh
?
I'm also getting this issue on Yosemite:
nvm is not compatible with the npm config "prefix" option: currently set to "/usr/local/Cellar/nvm/0.27.1/versions/node/v4.1.1"
Run `nvm use --delete-prefix v4.1.1 --silent` to unset it.
Once I run nvm use --delete-prefix v4.1.1 --silent
it starts working normally, but I have to do it every time I open a new session.
@rudeworks nvm
is utterly unsupported on homebrew - please brew uninstall
that, and install using the proper curl command in the readme, and see if you're still having issues?
I get the same error on Yosemite:
nvm is not compatible with the npm config "prefix" option: currently set to "/Users/cristik/.nvm/v0.10.38" Run
npm config delete prefixor
nvm use --delete-prefix v0.10.38 --silentto unset it.
and I installed using the curl command in readme.
@ckiss thanks - also on zsh
?
FWIW I'm also getting this on Arch Linux also with zsh
, with nvm installed both via curl
and by manually cloning and sourcing nvm.sh in my .zshrc
.
I hadn't updated nvm in a while, but I did just notice that the last 'good' tag (i.e. no error shown) was v0.26.1. I'll see if I can find the actual commit where this begins.
Thanks - I'm quite certain it's simply the commit where I added this check, which suggests that the check doesn't work properly in zsh
. @jaromero, can you also confirm whether you are or are not using oh-my-zsh
?
Sorry, I am using oh-my-zsh yes. And just to confirm, the first bad commit is 1458de7
One thing I am doing though, is symlinking ~/.nvm to ~/Development/nvm (i.e. ~/.nvm is the symlink). So npm config get prefix
always gives me a result that is outside of ~/.nvm.
Getting rid of the symlink, and moving the nvm dir to a single location and sourcing it from there only, also gets rid of the error.
@jaromero Sadly that is unsupported/broken at the moment - see #617. I think supporting that use case is a separate issue. Thank you for the data point though!
@ljharb I have tried nvm with pure zsh
, with oh-my-zsh
and with zgen
all of them have this bug
@foray1010 thank you for confirming! I'm still not seeing it locally on Yosemite, but I'll keep looking.
@ljharb I'm using osx bash terminal
@ckiss you may have a different issue. what's echo $NVM_DIR
print out?
I installed it using curl and $NVM_DIR prints out /Users/cristik/.nvm/
@ckiss and nvm debug
? If this doesn't help me figure it out, and you can use irc, i'm in #nvm on freenode as well - we can troubleshoot there.
@ljharb here is the output for nvm debug
:
$SHELL: /bin/bash
$NVM_DIR: '$HOME/.nvm/'
$PREFIX: ''
$NPM_CONFIG_PREFIX: ''
nvm current: none
which node:
which iojs:
which npm: /usr/local/bin/npm
npm config get prefix: env: node: No such file or directory
npm root -g: env: node: No such file or directory
Thanks - that doesn't make any sense, it's exactly what I've got, and mine works. I assume your $HOME
is on your primary disk (and you don't have any weird mount stuff going on)?
@ljharb nps. Yes, nothing unusual. Though if I run nvm use --delete-prefix v0.10.38 --silent
and then i run nvm debug
again I get completely different results:
$SHELL: /bin/bash
$NVM_DIR: '$HOME/.nvm/'
$PREFIX: ''
$NPM_CONFIG_PREFIX: ''
nvm current: system
which node: $NVM_DIR/v0.10.38/bin/node
which iojs:
which npm: $NVM_DIR/v0.10.38/bin/npm
npm config get prefix: $NVM_DIRv0.10.38
npm root -g: $NVM_DIRv0.10.38/lib/node_modules
ooh, a difference! my npm config get prefix
is $NVM_DIR/v0.10.38
(note the slash) and my npm root -g
is $NVM_DIR/v0.10.38/lib/node_modules
. I'd bet that's the difference. Also, I note that nvm current
prints out "system".
Could you gist your bashrc? Unless you have sed
aliased in which case this is a red herring.
Thanks, no help there either.
Clearly there's something different about your system, and about those reporting above, that's making the prefix check fail. Basically, all it's doing is seeing if the npm config get prefix
value is contained inside the $NVM_DIR
value.
The omz
and zsh
users may have an option set I'm not accounting for, but that doesn't explain @ckiss' bash error. :-/ I'll keep looking into this for sure.
thanks @ljharb I'll keep looking myself and I'll let you know if I find something
same here, on OSX 10.10.4 (Yosemite)
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 v0.12.2 --silent` to unset it.
⚡ nvm debug
$SHELL: /bin/zsh
$NVM_DIR: $HOME/.nvm
nvm current: none
which node: node not found
which iojs: iojs not found
which npm: /usr/local/bin/npm
npm config get prefix: env: node: No such file or directory
npm root -g: env: node: No such file or directory
⚡ nvm use --delete-prefix v0.12.2 --silent
⚡ nvm debug
$SHELL: /bin/zsh
$NVM_DIR: $HOME/.nvm
nvm current: v0.12.2
which node: $NVM_DIR/versions/node/v0.12.2/bin/node
which iojs: iojs not found
which npm: /usr/local/bin/npm
npm config get prefix: /usr/local
npm root -g: /usr/local/lib/node_modules
If I can help in anyway, tell me
@jobwat in your case, you have your npm prefix set to /usr/local
- that's what nvm
is incompatible with. You'll need to unset it to be able to use nvm
- for you, the console output is actually correct :-)
Hi all, I had this issue and was able to resolve it. For what it is worth, I brew uninstalled nvm mostly because the version was not up to date with the latest and above it is recommended not to use brew. Then I copied my versions to the new install just to make it quicker and eliminate the need to install again along with node modules. I noticed that the one version I was getting the warning / error was using the brew npm and not the one from nvm version. The other nvm versions were fine. So, I nvm uninstalled and re-installed. That fixed it.
Very wild guess here, but this may have something to do with case (in)sensitivity. I have:
export NVM_DIR="${HOME}/.nvm"
in my zshrc, but:
echo $HOME
=> /Users/isaac
echo $NVM_DIR
=> /Users/Isaac/.nvm
and I saw this issue. Updating my zshrc to be export NVM_DIR="~/.nvm"
has also not fixed this.
¯_(ツ)_/¯
@isaacseymour aha! that is a very helpful clue, thanks!
@foray1010 @ckiss what are all your echo $HOME && echo $NVM_DIR
output?
What if you try export NVM_DIR="/Users/isaac/.nvm"
?
I've added $HOME
info to nvm debug
in c957989fa96ca28994e130cc3682eee87eb40a9f to hopefully try to catch this sooner next time :-)
Then it's totally fine. I'm still really confused as where the capital is creeping in - putting an echo $HOME
or echo "${HOME}/lol"
right above export NVM_DIR="${HOME}/.nvm"
prints out the correct value. Computers.
Ok, I've actually just wasted loads of your time - this was a totally different issue. I somehow ended up with export NVM_DIR="/Users/Isaac/.nvm"
in a gitignored file (so ag
didn't find it...sigh). Removing that has everything fixed. The case change may have something to do with other peoples' issues though (I hope!)
@isaacseymour Awesome, thanks for clarifying!
Just a little update here as it may help some:
The wrong npm (/usr/local/lib/node_modules/npm/bin/npm
) was symlinked to /usr/local/bin/npm
I removed the symlink, so now my npm is the nvm one ($NVM_DIR/versions/node/<version>/bin/npm
)
And no prefix anymore :)
@jobwat Thanks for confirming :-)
@foray1010 @ckiss can you confirm the casing of your username?
my $NVM_DIR
is pointed to /usr/local/opt/nvm
, installed by brew, OSX 10.11
@foray1010 homebrew isn't supported by nvm
- can you try removing it via brew, and installing it properly via the curl command in the readme, and tell me if you still see this problem?
Very annoying issue; every time I want to use node or NPM, I get this error and need to run a command to solve it.