Fix NVM error - exit status 1 Access is denied

When selecting a specific version of Node to use with NVM, you may encounter an error saying that Access is denied.

The error doesn’t give further detail as to why nvm use command is denied:

$ nvm use 16.15.0
exit status 1: Access is denied

This error occurs because Windows restricted your user account from executing the task required to change the active Node version.

The nvm use command needs to create symlinks to create the right PATH to Node.js in your system.

There are four possible fixes for this error:

  1. Running the terminal as Administrator
  2. Activate Windows Developer Mode
  3. Don’t install NVM in C:\Program Files
  4. Remove any existing Node.js in your computer

This tutorial shows how you can apply these fixes in practice

1. Running the terminal as Administrator

The easiest way to fix this error is to open your Command Prompt as administrator.

You need to open the Start menu and search for “command”, then select the Run as administrator menu as shown below:

Try running the nvm use command again:

$ nvm use 16.15.0
Now using node v16.15.0 (64-bit)

Note that this time the command works perfectly.

2. Activate Windows Developer Mode

Alternatively, you can also enable Developer Mode on Windows 10, which will grant the permission to create symlinks.

Navigate to Settings > Update & Security > For developers and turn Developer Mode on as shown below:

Enabling developer Mode requires administrator access, so the option might be disabled when you’re using a device owned by your company or client.

What’s more, the Developer Mode menu effect has been changed in the latest Windows 10 version.

In Windows 10 v10.0.19043, the Developer Mode setting is different than the screenshot above:

This version of Developer Mode only allows you to install apps from any source. It doesn’t grant you the elevated permission to create symlinks.

The Windows 11 version has the same Developer Mode option as the Windows 10 19043 as well, so it won’t help to resolve the error.

3. Don’t install NVM in C:\Program Files

The administrator permission is usually required only when you install NVM in C:\Program Files. Windows require admin privilege when accessing this folder to prevent unauthorized modification to the computer.

If you already installed NVM in this folder, then you need to reinstall the program in another folder. I recommend you create a new folder in C:/nvm or D:/nvm to resolve this error.

4. Remove any existing Node.js in your computer

Any version of Node.js you installed using Node’s official installer or Chocolatey will conflict with NVM, so you need to remove any existing versions of Node.js on your computer before installing NVM.

First, uninstall NVM from your computer, then uninstall any versions of Node.js still available on your system.

Once done, reinstall NVM in a location that doesn’t require administrator permissions, and try running the nvm use command again.

Conclusion

NVM for Windows requires administrator privilege when you need to switch the active Node version using the nvm use command.

If you have administrative rights to the computer and you need to change Node version frequently, you can open two shells to work effectively:

  • An Admin shell to run nvm use commands
  • A regular user shell to run npm or node commands in your project

But it’s even better if you can reinstall NVM in a location other than C:\Program Files to avoid this permission issue altogether.

I hope this tutorial helps. Happy coding! 👍

Take your skills to the next level ⚡️

I'm sending out an occasional email with the latest tutorials on programming, web development, and statistics. Drop your email in the box below and I'll send new stuff straight into your inbox!

No spam. Unsubscribe anytime.