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]: NVM for Windows should be run from a terminal such as CMD or PowerShell. #1126

Open
wangxiaoze-view opened this issue Apr 23, 2024 · 4 comments

Comments

@wangxiaoze-view
Copy link

What happened?

I want to run "nvm ls" through node:exec or spawn, but now there is a problem: "NVM for Windows should be run from a terminal such as CMD or PowerShell";

Version: 1.1.12, but version 1.1.11 can run normally;

I don't know what is causing the problem? Can I just downgrade the version?

image

What did you expect to happen?

I think it should be able to output the node version installed on the computer!

Version

1.1.11 or newer (Default)

Which version of Windows?

Windows 10 (Default)

Which locale?

English (Default)

Which shell are you running NVM4W in?

Command Prompt, PowerShell

User Permissions?

I don't know (Default)

Is Developer Mode enabled?

No (Default)

Relevant log/console output

NVM for Windows should be run from a terminal such as CMD or PowerShell

Debug Output

Running NVM for Windows with administrator privileges.

管理员: C:\WINDOWS\System32\cmd.exe - nvm  debug
Windows Version: 10.0 (Build 19042)

NVM4W Version:      1.1.12
NVM4W Path:         D:\developTools\nvm\nvm.exe     
NVM4W Settings:     D:\developTools\nvm\settings.txt
NVM_HOME:           D:\developTools\nvm
NVM_SYMLINK:        D:\developTools\nodejs
Node Installations: D:\developTools\nvm

Total Node.js Versions: 3
Active Node.js Version: v21.1.0

IPv6 is enabled. This can slow downloads significantly.

PROBLEMS DETECTED
-----------------
"管理员: C:\WINDOWS\System32\cmd.exe - 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

Anything else?

No response

@wangxiaoze-view
Copy link
Author

Only through the terminal? Can Node be supported?

@coreybutler
Copy link
Owner

This is due to a change that identifies the terminal. The change was added in 1.1.12 and has been nothing but a pain for everyone. It will be reverted in the next release, but it may be a little while before the next release (our code signing cert was locked when trying to automate the code signing process and I'm trying to get it unlocked).

Revert to 1.1.11 for the time being. The changes between 1.1.11 and 1.1.12 are primarily just debugging. Most people won't experience a difference between the two.

@wangxiaoze-view
Copy link
Author

This is due to a change that identifies the terminal. The change was added in 1.1.12 and has been nothing but a pain for everyone. It will be reverted in the next release, but it may be a little while before the next release (our code signing cert was locked when trying to automate the code signing process and I'm trying to get it unlocked).

Revert to 1.1.11 for the time being. The changes between 1.1.11 and 1.1.12 are primarily just debugging. Most people won't experience a difference between the two.

Thank you, I understand; it is really inconvenient to use Node to develop some functions in version 1.1.12; it seems that the only way is to downgrade the version to 1.1.11;

Also hope this issue can be fixed soon;

@arm-liang
Copy link

arm-liang commented May 23, 2024

Use that powershell script below
The alert "Terminal only", you should start a new process with terminal window;

# change node version
# keep same with .nvmrc version
# used for webstorm adding external-tools when before launch
# used for vscode when task dependsOn
if(Test-Path .nvmrc){
}else {
    echo "no .nvmrc file"
    return
}
$curVer = node -v
$curVer = $curVer -replace 'v', ''
$cfgVer = Get-Content .nvmrc
if($curVer -eq $cfgVer)
{
    echo "no need to switch version"
}else{
    # change version
    echo "change node version to $cfgVer"
    start powershell "nvm use $cfgVer"
    # wait 5 second for nvm process run to finish
    Start-Sleep -Seconds 5
}

image

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

3 participants