Skip to content

MacOS Prefix NVM_VERSION_DIR != NVM_NPM_PREFIX #2315

@dylanarmstrong

Description

@dylanarmstrong

The directory and prefix are mismatched on line 2233 in nvm.sh due to a forward slash at end of directory:

  if [ "${NVM_VERSION_DIR}" != "${NVM_NPM_PREFIX}" ] && ! (nvm_tree_contains_path "${NVM_VERSION_DIR}" "${NVM_NPM_PREFIX}" >/dev/null 2>&1); then
NVM_VERSION_DIR=/Users/dylan/.nvm/versions/node/v12.19.0/
NVM_NPM_PREFIX=/Users/dylan/.nvm/versions/node/v12.19.0

It's fixable by switching the equals to use the -ef comparison, I will put in a PR for this.

Operating system and version:

macOS Catalina 10.15.7

nvm debug output:

~ > nvm debug
nvm --version: v0.36.0
$TERM_PROGRAM: iTerm.app
$SHELL: /bin/zsh
$SHLVL: 1
whoami: 'dylan'
${HOME}: /Users/dylan
${NVM_DIR}: '${HOME}/.nvm'
${PATH}: ${NVM_DIR}/versions/node/v12.19.0//bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/Library/Apple/usr/bin
$PREFIX: ''
${NPM_CONFIG_PREFIX}: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'zsh 5.7.1 (x86_64-apple-darwin19.0)'
uname -a: 'Darwin 19.6.0 Darwin Kernel Version 19.6.0: Mon Aug 31 22:12:52 PDT 2020; root:xnu-6153.141.2~1/RELEASE_X86_64 x86_64'
checksum binary: 'shasum'
OS version: Mac 10.15.7 19H2
curl: /usr/bin/curl, curl 7.64.1 (x86_64-apple-darwin19.0) libcurl/7.64.1 (SecureTransport) LibreSSL/2.8.3 zlib/1.2.11 nghttp2/1.39.2
wget: /usr/local/bin/wget, GNU Wget 1.20.3 built on darwin19.0.0.
sed: /usr/bin/sed
cut: /usr/bin/cut
basename: /usr/bin/basename
rm: rm: aliased to nocorrect rm -v (nocorrect rm -v)
mkdir: mkdir: aliased to nocorrect mkdir -v (nocorrect mkdir -v)
xargs: /usr/bin/xargs
git: /usr/local/bin/git, git version 2.28.0
ls: grep:: No such file or directory
grep: grep: aliased to grep --color=auto (grep --color=auto), grep (BSD grep) 2.5.1-FreeBSD
awk: /usr/bin/awk, awk version 20070501
nvm current: v12.19.0
which node: ${NVM_DIR}/versions/node/v12.19.0//bin/node
which iojs: iojs not found
which npm: ${NVM_DIR}/versions/node/v12.19.0//bin/npm
npm config get prefix: ${NVM_DIR}/versions/node/v12.19.0
npm root -g: ${NVM_DIR}/versions/node/v12.19.0/lib/node_modules

nvm ls output:

~ > nvm ls

      v12.19.0/
         system
default -> v12 (-> v12.19.0/)
node -> stable (-> v12.19.0/) (default)
stable -> 12.19 (-> v12.19.0/) (default)
iojs -> N/A (default)
unstable -> N/A (default)
lts/* -> lts/erbium (-> v12.19.0)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.22.1 (-> N/A)
lts/erbium -> v12.19.0

How did you install nvm?

Install script in README

What steps did you perform?

Uninstalling and reinstalling

What happened?

Get the following error:

nvm is not compatible with the npm config "prefix" option: currently set to "/Users/dylan/.nvm/versions/node/v12.19.0"
Run `npm config delete prefix` or `nvm use --delete-prefix v12.19.0/ --silent` to unset it.
Make sure your username (dylan) matches the one in your $HOME path.
See the "macOS Troubleshooting" section in the docs for more information.

What did you expect to happen?

Not get that error

Is there anything in any of your profile files that modifies the PATH?

.zshrc

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS: Mac OSneeds followupWe need some info or action from whoever filed this issue/PR.pull request wantedThis is a great way to contribute! Help us out :-Dshell: zsh

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions