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

Viewed 18455

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

I had the same issue in a windows environment. I solved it by running the nvm commands in the command line cmd in the root directory C:/ rather than the integrated terminal of vscode.

  • Run cmd as an administrator
  • Download the node version you want to use and use it
$ nvm download 12.18.0
$ nvm use 12.18.0

If you see the same error, you should configue the PATH in the Environment Variables like this answer is saying.

  • Go back to the other directory or in VsCode and try
node -v

and you'll see that you're using 12.18.0

Try to install the nvm directly in C:/ or in other folder without spaces in the PATH.

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.

Andrew's answer worked for me. I was installing in C:\apps but still getting "exit status 1: You do not have sufficient privilege to perform this operation". I right-clicked the command prompt icon and chose "run as administrator", and then I was able to run "nvm use 16.13.2". Nothing new here, upvote his answer. I just didn't have enough rep to comment.

Related