[Issue]: Cannot switch nodejs
AlexanderDash opened this issue · 16 comments
What happened?
C:\Users\alexa>nvm ls
20.11.0
- 16.20.2 (Currently using 64-bit executable)
C:\Users\alexa>nvm use 20
node v20.11.0 (64-bit) is not installed.
C:\Users\alexa>nvm use 20.11.0
node v20.11.0 (64-bit) is not installed.
why?????????????????????????????????????????????????????
What did you expect to happen?
fix
Version
1.1.11 or newer (Default)
Which version of Windows?
Windows 11+
Which locale?
None
Which shell are you running NVM4W in?
No response
User Permissions?
Administrative Privileges, Elevated
Is Developer Mode enabled?
None
Relevant log/console output
No response
Debug Output
.
Anything else?
No response
Not enough info. Please run nvm debug
and paste the results here.
My computer is a Windows 11 ARM architecture CPU 8cxgen3. I downloaded the Windows ARM version of nodejs from the official website and placed it in D: \ Program Files \ nvm. Although it is arm64 bit, the message returned by nvm is 32bit...
I tried NVM install 20.14.0 and downloaded nodejs 20.14.0 x64 bit. Then, I deleted all the files inside and copied the arm version of nodejs into this folder. Then, I entered NVM ls and it displayed 32 bit. Then, I used NVM 16 to switch to another version. Then NVM uses 20 and displays node v20.14.0 (64 bit) as not installed. I don't know what bug this is, and NVM cannot download arm64 version of nodejs............
Not enough info. Please run
nvm debug
and paste the results here.
(base) PS D:\HBuilderProjects\PicSelect> nvm debug
alexa is not using admin or elevated rights.
C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe
Windows Version: 10.0 (Build 22631)
Windows Developer Mode: UNKNOWN (user cannot read registry)
NVM4W Version: 1.1.12
NVM4W Path: D:\Program Files\nvm\nvm.exe
NVM4W Settings: D:\Program Files\nvm\settings.txt
NVM_HOME: D:\Program Files\nvm
NVM_SYMLINK: D:\Program Files\nvm\nodejs
Node Installations: D:\Program Files\nvm
Total Node.js Versions: 2
Active Node.js Version: v16.20.2
IPv6 is enabled. This can slow downloads significantly.
No problems detected.
Find help at https://github.com/coreybutler/nvm-windows/wiki/Common-Issues
I'm not sure how it got into this state, but run nvm install 20 64
to force the 64-bit install.
The primary issue appears to be a user account lacking permission to use mklink (the underlying windows utility used to generate symlinks). See permission issues.
C:\Users\alexa>nvm debug
Running NVM for Windows with administrator privileges.
管理员: 命令提示符 - nvm debug
Windows Version: 10.0 (Build 22631)
NVM4W Version: 1.1.12
NVM4W Path: D:\Program Files\nvm\nvm.exe
NVM4W Settings: D:\Program Files\nvm\settings.txt
NVM_HOME: D:\Program Files\nvm
NVM_SYMLINK: D:\Program Files\nvm\nodejs
Node Installations: D:\Program Files\nvm
Total Node.js Versions: 2
Active Node.js Version: v16.20.2
IPv6 is enabled. This can slow downloads significantly.
PROBLEMS DETECTED
"管理员: 命令提示符 - nvm debug" is not an officially supported shell. Some features may not work as expected.
Find help at https://github.com/coreybutler/nvm-windows/wiki/Common-Issues
C:\Users\alexa>nvm ls
20.14.0
- 16.20.2 (Currently using 64-bit executable)
C:\Users\alexa>nvm use 20
node v20.14.0 (64-bit) is not installed.
C:\Users\alexa>nvm use 20.14.0
node v20.14.0 (64-bit) is not installed.
C:\Users\alexa>nvm debug
Running NVM for Windows with administrator privileges.
管理员: 命令提示符 - nvm debug
Windows Version: 10.0 (Build 22631)
NVM4W Version: 1.1.12
NVM4W Path: D:\Program Files\nvm\nvm.exe
NVM4W Settings: D:\Program Files\nvm\settings.txt
NVM_HOME: D:\Program Files\nvm
NVM_SYMLINK: D:\Program Files\nvm\nodejs
Node Installations: D:\Program Files\nvm
Total Node.js Versions: 2
Active Node.js Version: v16.20.2
IPv6 is enabled. This can slow downloads significantly.
PROBLEMS DETECTED
"管理员: 命令提示符 - nvm debug" is not an officially supported shell. Some features may not work as expected.
Find help at https://github.com/coreybutler/nvm-windows/wiki/Common-Issues
C:\Users\alexa>nvm ls
20.14.0
- 16.20.2 (Currently using 64-bit executable)
C:\Users\alexa>nvm use 20
node v20.14.0 (64-bit) is not installed.
C:\Users\alexa>nvm use 20.14.0
node v20.14.0 (64-bit) is not installed.
C:\Users\alexa>nvm use 20.14.0 32-bit
node v20.14.0 (64-bit) is not installed.
It's not a permission issue. You see, even though I'm currently in the administrator cmd, I still can't solve the problem. NVM has recognized the ARM 64bit version of nodejs as 32-bit.. I think that's the key. NVM does not consider arm64 bit to be 64 bit...
I'm not sure how it got into this state, but run
nvm install 20 64
to force the 64-bit install.The primary issue appears to be a user account lacking permission to use mklink (the underlying windows utility used to generate symlinks). See permission issues.
(base) PS D:\HBuilderProjects\PicSelect> nvm install 20
Downloading node.js version 20.14.0 (64-bit)...
Extracting node and npm...
Complete
npm v10.7.0 installed successfully.
Installation complete. If you want to use this version, type
nvm use 20.14.0
(base) PS D:\HBuilderProjects\PicSelect> nvm use 16
Now using node v16.20.2 (64-bit)
(base) PS D:\HBuilderProjects\PicSelect> nvm ls
20.14.0
-
16.20.2 (Currently using 64-bit executable)
(base) PS D:\HBuilderProjects\PicSelect> nvm use 20
Now using node v20.14.0 (64-bit)
(base) PS D:\HBuilderProjects\PicSelect> nvm ls -
20.14.0 (Currently using 64-bit executable)
16.20.2
(base) PS D:\HBuilderProjects\PicSelect>
You see, I deleted the folder of nodejs v20 from the original arm64, and then NVM installed 20. It can switch normally..
OK, so if the executable is actually 64 bit, then it is actually 64-bit. Detecting architecture of an executable is a bit of a hack and won't always work. Since there isn't direct arm support yet (there is a PR I plan to merge to support this), I suspect the architecture detection simply isn't accounting for arm.
There's not a lot I ca do about this immediately, but once arm support is added, I believe this issue will be resolved. I'll leave this open until the PR is merged and will readdress this after that is complete.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
I have node installed through VS 2022 and nvm can't ever use any other version. I can't uninstall it as it's required. Do I have to have all versions installed through nvm-windows or something cus it won't work.
@Kamek437 run nvm debug
. I suspect you'll get a problem showing that the version you installed through VS 2022 precedes NVM4W on the PATH. See the common issues if this is the case. If not, open a new issue.
I had the same problem today.
However, in my case, the cause was leftover files from uninstalling the original node.js.
The nodejs folder remained in the following location without being deleted, so the symbolic link that NVM for Windows was supposed to create was not created and the switch could not be made.
C:\Program Files\notejs
@coreybutler Right you are my friend, thank you.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This issue was closed because it has been stalled for 7 days with no activity.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This issue was closed because it has been stalled for 7 days with no activity.