[Issue]: nvm use command is not working
Closed this issue ยท 17 comments
What happened?
I tried to the below command but getting error message as node is not recognized.
C:\joyee\study>nvm install 0.10.38
C:\joyee\study>nvm use 0.10.38
C:\joyee\study>node -v
And I got
'node' is not recognized as an internal or external command, operable program or batch file.
What did you expect to happen?
node -v command to show the node version in use
Version
1.1.11 or newer (Default)
Which version of Windows?
No response
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 current version. Run 'nvm use x.x.x' to set a version.
Debug Output
No current version. Run 'nvm use x.x.x' to set a version.
Anything else?
No response
Please provide the output of nvm debug
.
@coreybutler Please see the below output
PS C:\Windows\system32> nvm use 6
Now using node v6.17.1 (64-bit)
PS C:\Windows\system32> nvm current
No current version. Run 'nvm use x.x.x' to set a version.
I already tried the suggestions mentioned in this issue. #58
@manjunathreddy1 There isn't much I can do without the output of the debug command, which you have not provided. It should look like this.
@coreybutler Please see this screenshot.
@manjunathreddy1 Does that file exist? It should. Here's an example. If you can save in ASCII format, you'll likely have more success. See #726 for more details and workarounds.
Do you have the same problem also installing and using recent versions of node (for example >18)?
If not, it's probably related to this other bug #1179
Workaround: #1179 (comment)
I had a problem that I couldn't install any version of node. Now I was able to fix it. I reinstalled the latest version of nvm, and downloaded and installed the msi of the node versions I need. But I still have the problem of not being able to download by terminal
@ACaminos do not install the MSI versions from Node.js and NVM for Windows at the same time. The MSI versions force one version installation at a time.
I'll need more information to help troubleshoot, but the first step is removing the msi installation and installing a more recent version of NVM for Windows.
I'm facing the same issue. I've had an IT update last night (don't have the details of the operation unfortunately), but since this morning node and npm can't be found in the PATH.
Note that I did not change anything on nvm side.
What do you recommend?
nvm list
C:\Windows\System32>nvm list
20.12.2
20.8.1
18.13.0
16.16.0
14.21.3
nvm use
C:\Windows\System32>nvm use 20.12.2
Now using node v20.12.2 (64-bit)
node -v && npm -v
C:\Windows\System32>node -v
'node' is not recognized as an internal or external command,
operable program or batch file.
C:\Windows\System32>npm -v
'npm' is not recognized as an internal or external command,
operable program or batch file.
nvm debug
Microsoft Windows [Version 10.0.22631.4460]
(c) Microsoft Corporation. All rights reserved.
C:\Windows\System32>nvm debug
Running NVM for Windows with administrator privileges.
Administrator: Command Prompt - nvm debug
Windows Version: 10.0 (Build 22631)
NVM4W Version: 1.1.12
NVM4W Path: C:\MyPrograms\nvm\nvm.exe
NVM4W Settings: C:\MyPrograms\nvm\settings.txt
NVM_HOME: C:\MyPrograms\nvm
NVM_SYMLINK: C:\MyPrograms
Node Installations: C:\MyPrograms\nvm
Total Node.js Versions: 5
Active Node.js Version: none
(run "nvm use <version>" to activate a version)
IPv6 is enabled. This can slow downloads significantly.
PROBLEMS DETECTED
-----------------
NVM_SYMLINK (C:\MyPrograms) is not a valid symlink.
Find help at https://github.com/coreybutler/nvm-windows/wiki/Common-Issues
@Tyoneb the problem in the debug statement is pretty clear. nvm use
creates a symlink. If that symlink is invalid, it will fail. See https://github.com/coreybutler/nvm-windows/wiki/Common-Issues#nvm-use-fails (which I just created to help with this).
@coreybutler, thanks for the feedback and for updating the docs.
For some reason, the NVM_SYMLINK
environment variable on my system got changed suddenly from C:\MyPrograms\nodejs
to C:\MyPrograms
(which indeed is an existing directory and creating a symlink with that path will fail).
It's probably obvious to most users but I was unclear on what the SYMLINK was supposed to point to (and the incorrect value on my machine didn't help clarify it). I think your new doc section is quite clear and I'm pretty sure it would have helped me resolve the problem on my own.
Anyway, I got everything fixed now. Thanks again for the help!
We have run what may be a related issue on a couple of our developer machines - where a call to node
immediately after the nvm use
call in a script would fail with /d/develop/keyman/keyman/resources/shellHelperFunctions.sh: line 299: node: command not found
.
For us, I am guessing it's related to elevation -- we aren't seeing the issue on machinese where we've allowed symlinks to be created by regular users.
@mcdurdin there are a lot of unknowns when using non-Windows shells (which is why I've never formally supported them). Judging by the fact you're using unix paths and shell scripts, I'm guessing you're using cygwin or a similar shell doing transforms on paths and Windows APIs. It could be an elevation thing, but it could also be a simple malformed path.
I'm going to close this issue since the original poster has not replied in 3 weeks.