coreybutler / nvm-windows

A node.js version management utility for Windows. Ironically written in Go.
MIT License
37.28k stars 3.32k forks source link

[Issue]: NVM for Windows should be run from a terminal such as CMD or PowerShell. #1126

Closed wangxiaoze-view closed 1 week ago

wangxiaoze-view commented 5 months ago

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 commented 5 months ago

Only through the terminal? Can Node be supported?

coreybutler commented 5 months ago

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 commented 5 months ago

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 commented 4 months ago

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

github-actions[bot] commented 3 months ago

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.

kosiorKION commented 3 months ago

The reverting to 1.1.11 does not help

faithdennis commented 2 months ago

I'm having the same issue on 1.1.12 so I uninstalled 1.1.12 and used nvm-setup.exe from the 1.1.11 release as well as trying nvm install 1.1.11 and am getting an error that this version is not available and am only able to get 1.1.12. Looking for insight into how I can get to 1.1.11 if it helps, although kosioKION seems to suggest this might not be a fix either.

bruceleban commented 2 months ago

Also fails with git bash (https://git-scm.com/download/win).

The issue is unassigned. Is there any ETA or workaround? Thanks.

coreybutler commented 2 months ago

@faithdennis download 1.1.11 from here: https://github.com/coreybutler/nvm-windows/releases/tag/1.1.11

@bruceleban git bash is not a supported shell... never has been. See https://github.com/coreybutler/nvm-windows/wiki/Common-Issues#special-terminal-shells

sdarwin commented 1 month ago

Just hit the issue. It would be worthwhile to release a new version, to get past it.

coreybutler commented 1 month ago

Our signing certificate has been locked out for awhile. I've tried to get a new one with Microsoft trusted signing, but they won't validate our company identity (likely because the company was formed this year and MS requires 3yrs of tax returns). Bottom line, I'm still working on a way to get a new release code signed.

coreybutler commented 1 week ago

I'm closing this issue to merge with #1068 where most of the conversation has been taking place.