Edgecase for 'nvm is not compatible with the npm config "prefix" option' error #2261
Description
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.