I'm getting 'access is denied' when I'm using nvm -v command in windows 10. I have got the similar issue here NVM is Access Denied
But he himself gave a solution which is not working for me.
Is there any solution for this problem?
224 Answers
I encountered the same issue and solved it as follows:
- Uninstall "NVM for Windows 1.1.7"
- Run the installer
nvm-setup.exeas Administrator Open an elevated Command Prompt (with Administrator privileges) and run
nvm install 8.12.0nvm use 8.12.0
Now running node -v in a non-elevated Command Prompt works without issue. Hope this helps!
Not like the other comments, you don't have to run the installer nvm-setup.exe as Administrator. Just install it like a normal software.
Make sure that when you run nvm use xxx, you run it in Command Prompt with Administrator privilege.
- Install nvm-setup.exe as Administrator
- open cmd.exe as Administrator
- nvm install 14.17.6
- nvm use 14.17.6
My problem occurs on, particularly, Visual Studio Code.
The solution for my case is to run Visual Studio Code as an Administrator.
1I know this is a relatively old post and I believe most people landing here are trying to solve the access denied feature introduced with nvm 1.1.8 - I hope this is helpful to those folks.
This is covered in the repos wiki here
If you have access to enable developer mode on your machine - docs
You can enable developer mode and then when installing nvm for windows choose an install directory outside of the protected "Program Files" folder for nvm and nodejs.
I went with c:\Programs\nvm and c:\Programs\nodejs respectively, but you could also use APP_DATA as the base for both, or as suggested in the wiki 'nvm4w'.
I'm now able to use the latest nvm and run 'nvm use x.x.x' inside of VS Code.
2- -->Press window key + x.
- -->Windows PowerShell(Admin)
- -->Now use nvm normally, you won't get any error.
For me, I didn't wanted to run cmd with administrator rights every time I needed to change node version so what I did was go to NVM installation folder on windows is located at C:\Users\<username>\appdata\Roaming\nvm and modified the Properties>Compatibility to Run as adminstrator and now when I run nvm on my not-running-as-administrator-cmd it will just prompt me to confirm if execute as administrator.
- Execute terminal as admin
- Access the folder from terminal
- Use the same command for nvm, ex.:
nvm use 14.19.1
- Open command prompt
- Right click on command prompt item in toolbar
- then again right click on command prompt
- click on run as administrator
- then run nvm use
VersionNumber
For those using nvm v1.1.8 in Windows, I tried to install nvm and open it in cmd as an administrator., it didn't help.
Try using nvm v1.1.7. It worked for me :)
i have run command as a administrator it works
run cmd as administrator and then after enter
nvm use 8.12.0/or your version which you desired to use then it will work
[2022 UPDATE]
I came across this problem multiple times. Trying to run it as administrator, but then get an Error 145, or struggling because my integrated terminal in VSCode is not running as administrator by default...
Here is an Easy fix, recommanded by the NVM Windows team in the Common Issues Page.
1- Create a folder at the root of your disk called "nvm4w" : C:/nvm4w
2- Go back to your nvm-setup.exe and run it (if you lost it, then go back to the NVM-Windows Releases and download the latest nvm-setup.zip file.
3- Then, when the installer ask you to "Select the folder in wich Setup should create the sumlink", select that "nvm4w" folder you just created.
After this, everything will be fine, the administrator privileges are not required anymore.
3none of the admin cmd run-s described above solved access denied issue. However I reinstalled nvm in a C:\NVM\nvm and made the nodejs folder to be C:\NVM\nodejs and it worked without any access elevation.
thanks @Daniel McMullen for the link to Wiki
Version 1.1.9 of NVM for Windows has an issue that causes this problem. The solution is to remove it and then install version 1.1.7 (without Administrator privileges) and then it should work just fine.
1I uninstalled NodeJS and also nvm from the my computer. And then redownloaded the nvm and installed the NVM and then by using this command I installed the specific NodeJS version npm install 16.x.x.
I was getting same issue. I wanted to install nvm s I deleted node js folder in program files and then installed nvm but instead of command I installed node js from installer which cause this issue. To use nvm we must delete previous node js installed so I uninstalled node js and nvm from control panel and then followed the following steps:
- Installed nvm
- install node js using command 'nvm install v8.12.0'
- nvm use 8.12.0
I had installed the node version I wanted, but couldn't set it with nvm use [version] in Powershell. This worked for me:
- Download scoop and install sudo for Windows with it, using the instructions of the following link.
- Run
sudo nvm use [version].
Didn't find solution to my problem here, hence posting answer to this old question to benefit others.
I had installed node outside nvm without admin priviledges. In that case, no matter if you install or run nvm using admin priviledges, nvm use ____ will give access denied.
I uninstalled node manually, installed it from within nvm and then ran nvm use and it worked.
I just downgraded my version of nodejs by using the "nvm use..." command, since I found using nodejs v17 was causing my issue. When I set my (Windows 10) machine to use nodejs v16.14.0 the problem went away. To downgrade versions, I did the following, because there can also be difficulty doing that:
*Be carefull with Dev mode on
-- About Access Denied -- In this case, try with you Git Bash. Search your Git Bash > Open File Location > Right Click > Open Properties > Compatibility and check Run as Adminsitrator. Open Git Bash anywhere, type: nvm install version nvm list nvm use yourversion (ex. 17.99.99)
-- About NVM -v -- The command is: nvm version
I hope this solve your problem and others.
It could be proxy issue. You can set the proxy url that npm already uses.
This is how you can find npm proxy config:
npm config list Then set the same url for nvm:
nvm proxy "url" Run command prompt in administration
install node version with nvm
nvm install <node_version>(ex: nvm install 16.10.0)use installed node version
nvm use <node_version>(example:- nvm use 16.10.0)check node version
nvm list <node_version>
Or uninstall the previous nvm version and reinstall and do upper steps
"Elevation" refers "Windows Access Rights" by which Windows controls what you can do on the file, specifically what folders you can read and write to. You get them by using "Run As Administrator".
1. Enable Developer Mode
Settings -> Update & Security -> For Developers -> Activate Developer Mode
At this point, you will be able to use nvm without elevation.
2. Elevate nvm executable on demand
nvm root directory -> nvm.exe properties -> compatibility -> run this program as administrator -> apply
Whenever you need to use nvm, you will be prompted to grant elevation.
3. Run elevated command prompt
Press Windows + R, type cmd into the box and then press Ctrl + Shift + Enter.
Side note
I am not sure about this but I think you can use nvm 1.1.6 release without all that hassle.
1It Solve my issue in windows
- Remove node completely.
- Install NVM
- Open CMD as administrator
- Install node specific version
- switch on that version(nvm use yourversion)