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

[Issue]: Cannot switch nodejs #1147

Open
AlexanderDash opened this issue Jun 17, 2024 · 14 comments
Open

[Issue]: Cannot switch nodejs #1147

AlexanderDash opened this issue Jun 17, 2024 · 14 comments

Comments

@AlexanderDash
Copy link

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

@coreybutler
Copy link
Owner

Not enough info. Please run nvm debug and paste the results here.

@AlexanderDash
Copy link
Author

image
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.

@AlexanderDash
Copy link
Author

(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

@coreybutler
Copy link
Owner

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.

@AlexanderDash
Copy link
Author

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...

image

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.

@AlexanderDash
Copy link
Author

(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..

@coreybutler
Copy link
Owner

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.

Copy link

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.

@github-actions github-actions bot added the Stale Stale label Jul 22, 2024
@Kamek437
Copy link

Kamek437 commented Jul 28, 2024

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.

@coreybutler
Copy link
Owner

@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.

@github-actions github-actions bot removed the Stale Stale label Jul 29, 2024
@watch-activity
Copy link

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

@Kamek437
Copy link

Kamek437 commented Aug 3, 2024

@coreybutler Right you are my friend, thank you.

Copy link

github-actions bot commented Sep 3, 2024

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.

@github-actions github-actions bot added the Stale Stale label Sep 3, 2024
Copy link

This issue was closed because it has been stalled for 7 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 10, 2024
@coreybutler coreybutler reopened this Sep 10, 2024
@github-actions github-actions bot removed the Stale Stale label Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants