nvm: NVM is not compatible with the npm config "prefix" option warning (OS X)
Split off from https://github.com/creationix/nvm/issues/855 ; see that issue for a similar problem.
This is in OS X El Capitan, 10.11.6 . This error appears on starting a new shell:
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 v5.7.1 --silent` to unset it.
With the usual command in the .bashrc file:
export NVM_DIR="/Users/pingraham/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
Running either or both of the suggested fixes don’t appear to do anything, though.
Note: I foolishly installed some node version globally while trying to fix this, and also foolishly upgraded npm once in an attempt to fix this, but ran into an entirely different npm bug ( https://github.com/npm/npm/issues/13918 , if you’re curious ) before giving up. On the other hand, NVM seems to sorta work anyway…? Maybe?
Here’s some commands & their results:
node -v
v5.7.1
nvm use 5.7.1
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 v5.7.1` to unset it.
Running either or both of the suggested command doesn’t change anything.
Oddly enough, the switch seems to work anyway… maybe…
nvm use 0.10
Now using node v0.10.33 (npm v1.4.28)
node -v
v0.10.33
nvm use 5.7.1
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 v5.7.1` to unset it.
node -v
v5.7.1
(I guess it happened regardless??)
Debugging info:
echo $PREFIX ; echo $NPM_CONFIG_PREFIX
(nothing, just empty lines)
nvm debug
nvm --version: v0.32.0
$SHELL: /bin/bash
$HOME: /Users/pingraham
$NVM_DIR: '$HOME/.nvm'
$PREFIX: ''
$NPM_CONFIG_PREFIX: ''
nvm current: system
which node: /usr/local/bin/node
which iojs:
which npm: /usr/local/bin/npm
npm config get prefix: /usr/local
npm root -g: /usr/local/lib/node_modules
(nvm debug, after switching)
nvm current: v0.10.33
which node: $NVM_DIR/v0.10.33/bin/node
which iojs:
which npm: $NVM_DIR/v0.10.33/bin/npm
npm config get prefix: $NVM_DIR/v0.10.33
npm root -g: $NVM_DIR/v0.10.33/lib/node_modules
nvm ls
v0.10.33
v5.7.1
-> system
default -> 5.7.1 (-> v5.7.1)
node -> stable (-> v5.7.1) (default)
stable -> 5.7 (-> v5.7.1) (default)
iojs -> N/A (default)
lts/* -> lts/argon (-> N/A)
lts/argon -> v4.5.0 (-> N/A)
No prefixes set in the environment, either:
$PREFIX: ''
$NPM_CONFIG_PREFIX: ''
It seems wrong to just ignore the error! Any ideas on what I could change? And is it a “Real” error, or just noise, since it seems that at least node -v acknowledges the switches anyway?
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 8
- Comments: 66 (12 by maintainers)
Links to this issue
- winstonzhao/nvm - nvm - Gitea: Git with a cup of tea
- winstonzhao/nvm - nvm - Gitea: Git with a cup of tea
- nvm/README.md at 0ebda7eea397a0b09f4e51fafc944dc47b190b35 - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- nvm/README.md at 9849bf494d50e74aa810451fb1f83208b0092dd6 - nvm - Gitea: Git with a cup of tea
- nvm/README.md at df01d81128e20eccc6f3d5b15649099b3f07cf3e - nvm - Gitea: Git with a cup of tea
- nvm/README.md at ee6f766712093c9f505fab38317f2959e7846895 - nvm - Gitea: Git with a cup of tea
- nvm/README.md at eed0d0e85ccb35e8802b0df7061491e6cf5d6a4b - nvm - Gitea: Git with a cup of tea
- nvm/README.md at c92adb3c479d70bb29f4399a808c972ef41510e7 - nvm - Gitea: Git with a cup of tea
- nvm/README.md at d91087c333d57c1cf37e9875ae235a1640a44d98 - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- nvm/README.md at 1eaaada4994ab26ce5f0c591996344b330066cce - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- nvm/README.md at 15eba7b7e6f7e684812eb7a569b7e0fa9478f7c6 - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- nvm/README.md at 788c0a425e27d8c9beb3a1750c45c1c487829295 - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- nvm/README.md at 0d14d7f6b7ae615f06aae27de574cf6115170ef3 - nvm - Gitea: Git with a cup of tea
- nvm/README.md at travis - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- nvm/README.md at xcode-select - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- nvm/README.md at d4a733e4d88a78f2eda26f9039b21d7e9226ea74 - nvm - Gitea: Git with a cup of tea
- nvm/README.md at 4618ce0aa12b9a3582ada585ef6a1f2be595c573 - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- nvm/README.md at 70aa611abc3a376bfdfd902c5839e44fbde36404 - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- nvm/README.md at travis3 - nvm - Gitea: Git with a cup of tea
- nvm/README.md at temp6 - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- nvm/README.md at temp4 - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- nvm/README.md at bionic - nvm - Gitea: Git with a cup of tea
- nvm/README.md at npm8 - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- nvm/README.md at 1de3333651b8bafe8f8c8ed2769d2bb9335ce8ce - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
- nvm/README.md at master - nvm - Gitea: Git with a cup of tea
- shideqin/nvm: Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions - nvm - Gitea: Git with a cup of tea
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
- Tell tmux about Homebrew-managed bash Before this commit, I was getting nvm loading errors along the lines of: ``` nvm is not compatible with the npm config "prefix" option: currently set to "/usr/l... — committed to dleve123/dotfiles by dleve123 6 years ago
- Reinstall nvm due to https://github.com/nvm-sh/nvm/issues/1245 — committed to kkrull/dotfiles by kkrull 5 years ago
- set default shell to zsh As per... https://github.com/nvm-sh/nvm/issues/1245#issuecomment-370396741 — committed to mdb/dotfiles by mdb 4 years ago
nvm unalias default
worked for me! Much appreciated @MwumLi 🍻The Fix rm $(which npm) if and only if it was installed by a non-nvm node and is taking precedence over nvm’s node.
You can check this by doing the following:
If it points to something outside of $NVM_DIR it may be causing problems.
The explanation I ran into this today ONLY when starting tmux. I am using oh-my-zsh on a mac however I think the following may benefit anyone.
First, I uninstalled node from brew brew uninstall node Then I debugged a ton and found that the npm being used was a leftover from my brew node installation. npm was located at /usr/local/bin/npm but symlinked to /usr/local/lib/node_modules. Because of this, the default prefix was takining over and set to /usr/local.
So I performed the following to ensure brew’s node was gone:
No more errors YAY!
In hindsight, I believe all I really needed to do was either rm the npm symlink in /usr/local/bin and perhaps the npm install source at /usr/local/lib/node_modules/bin/npm (not sure of this path).
@peteringraham hm, it’s possible that
v5.7.1
is corrupted? could you trynvm uninstall v5.7.1 && nvm install v5.7.1
and see if the issue is fixed?Wow I’m tired of this issue - seems to affect me randomly on various machines and CI environments. 3 years old and still going strong.
Not sure why it’s marked as fixed? Nothing is fixed… none of the above solutions seem to work for me.
If you’re using any other shell than bash, make sure to configure your tmux that way:
This solved it for me.
@antony you can try the ways:
~/.zshrc
):When I use tmux, the bug apear, so I view code, find the real reason is PATH overlap which result in Determine if the nvm path exists error
How to solve the bug? There’re three way:
nvm unalias default
@ljharb I’m thinking the same thing. Removing the default alias fixed this but shouldn’t there be another way around this?
Update: As a workaround, I removed the default alias and then added the following to my
.bashrc
file.That did the trick but then I decided to give the chosen answer here one more shot (which I’m sure I had done in the past) and it actually worked for me.
If this doesn’t work for you then try unsetting default and then adding the
--delete-prefix
line I included above in your.bashrc
or.zshrc
file.I was able to leave the system node on and simply remove the npm install that it came with (might not need the system node anyway so it’s probably going out - it might be that something needed it - cannot remember…)
rm -rf /usr/local/lib/node_modules/npm
That was enough for me.
Thanks. This one helped for me.
None of the fixes here seem to have worked for me, and I get this error regardless of which version I’m trying to switch to.
However, if I merely run
nvm use
a second time, it succeeds. I wonder if that’s why some of these fixes “worked” for other folks here? If I open a new terminal I get the error again the first time I runnvm use
, and after that it’s okay.I tried all but still not work for me. I use
where node
and found I have a node of global in/usr/local/bin/node
. then I use this to delete itand then, it work for me!!!
@ljharb why yes 😃 moving source nvm after all of that fixed my problem, thanks! The offending line was pretty obvious in retrospect:
nvm unalias default
worked for me as well, thanks.I had this problem not when launching Ubuntu (in my WSL 1 env in Win10), but when opening tmux within it. Super annoying, those error messages should be removed since doing the fixes in them didn’t help at all.
@ljharb Thanks!
nvm uninstall v5.7.1 && nvm install v5.7.1
worked for me.It is not fixed! i’m having the same problem for multiple versions of node. tried uninstalling and reinstalling as suggested in some of the comments above. But that did not fix it for me.
Looks like it worked. I guess this was a side-effect of
sudo npm install -g
when trying to fix unrelated errors earlier.After running those, uninstalling, and reinstalling, no error message, node -v returns 5.7.1.
I’ll re-open if something surprising happens later, but I think this is mostly fixed.
Note that
nvm ls
now claims it’s using “5.7.1” rather than “system”, so maybe using the system version of node isn’t really supported? OTOH, this might be too specific & weird a situation to bother having specific commentary on.Thanks again for your help.
The route that got me to this error was mixing installations of node based packages using nvm and brew. This can get a bit painful as installing the heroku tools or yarn will install their own version of node. I was able to resolve my issues by only ever using nvm. Big YMMV.
Just run into this issue, and here’s what I did to fix it:
brew uninstall node
nvm install 'lts/*'
nvm alias default 'lts/*'
npm config delete prefix
npm config set prefix $NVM_DIR/versions/node/v12.18.1
I go this error because my
$HOME
contains a slash at the end on macOS 10.14 so myNVM_PATH
looked like this/Users/username//.nvm
. Changing theNVM_PATH
toexport NVM_DIR="$HOME.nvm"
solved the issue.EDIT: changing the home location in the macOS user settings is actually the better solution.
This worked for me! Thanks!
Doing that will mean your shell starts out without any node version available, please note.
@ljharb if you’re using nvm it should be located under your nvm versions like:
Not something like the following that mine was pointed at:
Yet when I ran
which node
it was pointing at nvm, so that’s why I was confused where the rouge global nvm came from. It might have been from some ruby gem I installed recently. I treat node installs Ephemerally so reinstalling isn’t much concern for me.Not sure what installed a global npm for me, but I ran this to have npm uninstall itself
Note: I had to run this twice.
Afterwards I uninstalled my current nvm node version I was on, and then reinstalled it to get a standard npm back and running.
Hope this helps someone…
Thanks. Worked for me.
@rifler are you using husky along with
commitizen
, by chance?the
latest
version ofhusky
(and many previous versions) leveragesnvm
to run your tests in the version of node defined in your.nvmrc
. the newest versions, that haven’t hitlatest
yet, don’t do this anymore (i think because it is assumed that if you are using nvm that you are already running the correct version through other means), so they avoid this problem.try
npm install husky@next -D
if this does apply to you and see if it resolves this particular issue.Good point @ljharb - the better fix was deleting the version entry in
${HOME}/.npmrc
. No idea how it got there…I had something like
source ~/.nvm/nvm.sh
in my~/.zshrc
. Once I removed it, i don’t see the error message.I came against the same problem. I reinstalled nvm, using zsh custom plugin, then everything went fine 😄
Here, section “As an Oh My ZSH! custom plugin”
@TitanNano’s fix worked fo rme too. Mine was set to
export NVM_DIR=~/.nvm
which i guess didn’t have a good reference back to the real homeIn my case, I just uninstalled nodejs installed by system (
sudo apt uninstall nodejs
), removed ~/.nvm folder, cleaned up .bashrc and .zshrc from nvm related commands, then installed nvm again.Pretty simple fix
Navigate to your .nvm folder remove all npm version, since you can just reinstall with nvm easily then run unset npm_prefix_config, then install some arbitrary npm version using nvm, then run nvm use {version you installed}
Boom npm is usable again.
EDIT:
My Mistake the final command you must run is
ln -s $(which node) /usr/local/bin/node
which should put the current node being used in the path.
I fixed this by deleting a
~/.huskyrc
file. Not sure how it got there, but I tested my hooks after deleting it and they still work.@ctsstc global npm comes with node, and you should never uninstall it - the only cure is reinstalling node to get it back.
@travi it helps, thank you!
MWumLi’s fix worked for me. Yes, this was highly annoying and time-consuming to fix. I’m happy to report the fix is quite simple.
@jedwards1211 is there any chance you have something in your shell profile files that modifies the PATH after nvm is sourced? If so, a second
nvm use
would correct the PATH.(also per https://github.com/creationix/nvm/issues/855#issuecomment-249264066, you don’t have any “prefix” in any
.npmrc
files, and per https://github.com/creationix/nvm/issues/855#issuecomment-249265561, you don’t have any case-insensitive form of “prefix” inenv
)I assume that
nvm ls
, after thenvm use
, has the->
pointing at “v5.7.1”?Do you have anything in
~/.bash_profile
and/or~/.bashrc
that refers toPATH
,nvm
, ornpm
?I’m seeing a few strange things here:
nvm use
complains about the prefix, but you don’t have any prefix overrides set anywherenvm use
complains about the prefix, the node version still changes (it should be runningnvm deactivate
after printing that error)