Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upNo npm prefix set, but nvm requires 'nvm use --delete-prefix' #2088
Comments
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
Looks like it's caused by the extra $ nvm use lts/carbon
nvm is not compatible with the npm config "prefix" option: currently set to "/home/paulk/.nvm/versions/node/v8.16.0"
Run `npm config delete prefix` or `nvm use --delete-prefix v8.16.0` to unset it.
$ nvm use lts/carbon
nvm is not compatible with the npm config "prefix" option: currently set to "/home/paulk/.nvm/versions/node/v8.16.0"
Run `npm config delete prefix` or `nvm use --delete-prefix v8.16.0` to unset it.
$ export NVM_DIR=/home/paulk/.nvm
$ nvm use lts/carbon
Now using node v8.16.0 (npm v6.4.1) |
|
aha, yes. does $HOME have an extra slash in it? |
|
I see that it does. $HOME is a directory path, and the trailing slash means “inside the dir”. If you fix that in your profile files, you should be fine. |
|
Funny, I had and could fix exactly the same problem this way this morning! Remove the trailing slash in $HOME https://serverfault.com/questions/876317/what-to-do-with-trailing-slash-in-home-on-centos |
|
I have other things that expect the trailing slash in the $HOME, so I fixed it when declaring $NPM_HOME instead. I would still consider this a bug and encourage you to fix whatever is parsing this. In shell, a path of |
|
For those coming here and you are using a Mac, my issue was that my user folder had upper case letters in it, but my profile folder setting under users pointed to the all lower case path version of it. Once I logged in from another account renamed to have all lower case all worked just fine. |
|
Just updated to Catalina (10.15.1) and had same issue |
nvm debugoutput:nvm lsoutput:$ nvm ls v8.16.0 v10.16.2 -> system node -> stable (-> v10.16.2) (default) stable -> 10.16 (-> v10.16.2) (default) iojs -> N/A (default) unstable -> N/A (default) lts/* -> lts/dubnium (-> v10.16.2) lts/argon -> v4.9.1 (-> N/A) lts/boron -> v6.17.1 (-> N/A) lts/carbon -> v8.16.0 lts/dubnium -> v10.16.2 </details> - How did you install `nvm`? (e.g. install script in readme, Homebrew): nvm installed from https://aur.archlinux.org/packages/nvm/ My ~/.bashrc ends with: <details> <!-- do not delete the following blank line --> ```sh export PATH="$PATH:$(yarn global bin)" export NVM_DIR="$HOME/.nvm" source /usr/share/nvm/init-nvm.shAnytime I run
nvm use {NODE_VERSION}it complainsIf I set a default alias, then the error message appears anytime I open a shell. NVM seems to work just fine if I use
nvm use --delete-prefixevery time I try to load a different NVM version.What did you expect to happen?
I expected nvm to silently switch to the specified node. I'd like to be able to set a default prefix.
Is there anything in any of your profile files (
.bashrc,.bash_profile,.zshrc, etc) that modifies thePATH?Yes, but it's all before the lines that load nvm.
My ~/.npmrc contains only the
local-address=10.1.2.123option.