Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edgecase for 'nvm is not compatible with the npm config "prefix" option' error #2261

Closed
mkarajohn opened this issue Jul 19, 2020 · 5 comments

Comments

@mkarajohn
Copy link
Contributor

mkarajohn commented Jul 19, 2020

Operating system and version:

MacOS Catalina 10.15.6

nvm debug output:

nvm --version: v0.35.3
$TERM_PROGRAM: Apple_Terminal
$SHELL: /bin/zsh
$SHLVL: 1
${HOME}: /Users/Mitch
${NVM_DIR}: '${HOME}/.nvm'
${PATH}: ${NVM_DIR}/versions/node/v14.5.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Wireshark.app/Contents/MacOS
$PREFIX: ''
${NPM_CONFIG_PREFIX}: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'zsh 5.7.1 (x86_64-apple-darwin19.0)'

nvm ls output:

How did you install nvm?

Install script

What steps did you perform?

What happened?

I was doing a clean install of nvm without any external installations of node or npm, I had made sure 1000% that there were no installations of node or npm prior to the installation of nvm.

When I was installing a node version, after having successfully installed nvm, I would always get a

nvm is not compatible with the npm config "prefix" option: currently set to <PATH>
Run `nvm use --delete-prefix v<VERSION>` to unset it.

Immediately after the message, running the list command would output as if the installation was successful, however running node -v would fail, as if node was not installed.

What did you expect to happen?

For the installation to be successful.

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

No.

The issue

Long story short, about a month back I was on MacOS High Sierra. I had to do a clean install of the OS and Catalina was used.
After recreating my user I did a restore from a TimeMachine backup.

Now, I've had this machine since 2015. At that time the OS apparently allowed you to have an account name that started with a capital letter. When I recreated my account on Catalina, I found out that the OS no longer allows to capitalise the username upon account creation.

Thus I ended up with a user mitch instead of Mitch, which is what it was named originally.

When I did the backup restore, my home folder must have been renamed back to "Mitch" from "mitch".

The OS, however, still regarded my home folder path as /Users/mitch, as seen from running echo $HOME and also from looking at the advanced account settings from the System Preferences.

Since the file system I am using is case insensitive, both /Users/mitch and /Users/Mitch work.

After not being able to find a solution to my issue, after having wasted quite a few hours on it, and there was no other installation of npm or node, I decided to change the home directory path from /Users/mitch to /Users/Mitch, as "Mitch" is the actual name of my home directory.

This must have been of importance for nvm, because changing the path from System Preferences, resolved all my issues.

This is a freak-edgecase for this error, but if you'd like I could at least open up a PR which adds a warning that "home directory path is case sensitive" or something like that, or even attempt to adjust the code itself, and offer a code PR.

@ljharb
Copy link
Member

ljharb commented Jul 20, 2020

You're definitely not the first person who's reported that the capitalization of their whoami and of their username in $HOME do not agree, but you are the first one to provide an actual narrative of how that might have possibly happened! :-D

I'd be happy to accept a PR for a documentation section and/or a warning in nvm's output itself in this case instructing users (probably on mac only, for now?) to compare echo $HOME with whoami.

@ljharb
Copy link
Member

ljharb commented Aug 3, 2020

Fixed by #2263.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants
@ljharb @mkarajohn and others