Search code examples
node.jscmdnvm

getting exit status 1 when I run the command nvm use 12.18.0


I have installed nvm on my windows machine and with nvm, I installed 2 node versions but it's not letting me change the version.

Microsoft Windows [Version 10.0.16299.64]
(c) 2017 Microsoft Corporation. All rights reserved.

C:\Windows\system32>nvm use 12.18.0
exit status 1: 'C:\Users\Sarmad' is not recognized as an internal or external command,
operable program or batch file.


C:\Windows\system32>nvm version
1.1.7

C:\Windows\system32>nvm ls

  * 15.8.0 (Currently using 64-bit executable)
    12.18.0

C:\Windows\system32>nvm use 12.18.0
exit status 1: 'C:\Users\Ali' is not recognized as an internal or external command,
operable program or batch file.

Solution

  • Ali you are getting this error because you are installing nvm in the default location. And that is your user's directory. Nvm for windows is an attempt to port from the linux and currently does not support spaces in the path.

    I spent several hours trying to figure this out and none of these solutions work for me. If you install nvm in c:\tools\ directory, (you might already have one if not just create it) should solve the problem.

    UPDATE Jan - 2023 The writer of NVM for Windows has decided to deprecate it and there will be something coming up to replace it. See the announcement:

    https://github.com/coreybutler/nvm-windows/wiki/Runtime

    From the link:

    I intend to deprecate NVM for Windows after Runtime is released. There are two things slowing work on Runtime. First, client engagements. I am wrapping up the most time-consuming project this quarter and will have much more time in early spring 2023. The other thing slowing down Runtime development is this project. So, I'm freezing feature development on NVM for Windows.