Reputation: 2243
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?
Upvotes: 185
Views: 227559
Reputation: 63
Try to remove any existing version of Node.js which was installed via Node's official installer, winget or Chocolatey, and then retry the command in your terminal as an Administrator.
In my case, I had accidentally installed another version of Node.js using winget, which was causing conflict with NVM.
Upvotes: 0
Reputation: 173
One possible solution to this issue is to run the sfc /scannow
command in the Command Prompt with administrative privileges. The SFC (System File Checker) command checks for corrupted system files and repairs them if necessary. Here's how to do it:
Open the Command Prompt as an administrator. To do this, right-click on the Start menu and select Command Prompt (Admin)
Type the following command and press Enter: sfc /scannow
Wait for the scan to complete, which can take some time. If any corrupted files are found, the SFC command will automatically repair them.
Restart your computer and try installing NVM again. Note that this solution may not work for everyone, as the underlying cause of the error can vary. If the problem persists, there may be other steps that you can take, such as checking your antivirus software settings or performing a clean boot of your system.
I hope this helps! Let me know if you have any questions.
Upvotes: 1
Reputation: 177
My problem occurs on, particularly, Visual Studio Code.
The solution for my case is to run Visual Studio Code as an Administrator.
To run Visual Studio Code as an Administrator on Windows 11, search for Visual Studio from the Windows search bar, then right-click on the app of Visual Studio Code and select "Run as administrator".
Upvotes: 17
Reputation: 11
Im on Windows 11. I had the same issue and it worked for me to open the console as an administrator, and then run the nvm use lts
command.
Upvotes: 0
Reputation: 6878
I encountered the same issue and solved it as follows:
nvm-setup.exe
as Administratornvm install 8.12.0
nvm use 8.12.0
Now running node -v
in a non-elevated Command Prompt works without issue.
Upvotes: 201
Reputation: 11
If you have Node.js installed already, you need to uninstall it so it doesn’t lead to errors when using different versions of Node and installing packages from the NPM registry.
and finally, this article helped me much
Upvotes: 0
Reputation: 3918
Having nvm and want to use it in VSCode but getting those permission errors?
Settings -> Update & Security -> For Developers -> Activate Developer Mode
re-install nvm into C:\nvm & C:\nodejs
Add to path, Search -> edit the system environment variables -> environment variables -> path -> add -> C:\nvm
. Repeat for C:\nodejs
restart vscode, now your integrated terminals has the nvm path & will always have access to them.
Upvotes: 0
Reputation: 97
"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".
Settings -> Update & Security -> For Developers -> Activate Developer Mode
At this point, you will be able to use nvm without elevation.
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.
Press Windows + R, type cmd into the box and then press Ctrl + Shift + Enter.
I am not sure about this but I think you can use nvm 1.1.6 release without all that hassle.
Upvotes: 6
Reputation: 181
nvm use 14.19.1
Upvotes: 18
Reputation: 130
none 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
Upvotes: 4
Reputation: 439
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
Upvotes: 0
Reputation: 1979
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.
Upvotes: 5
Reputation: 25
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"
Upvotes: 0
Reputation: 1
*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.
Upvotes: 0
Reputation: 49
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: https://github.com/coreybutler/nvm-windows/issues/674#issuecomment-1050369304
Upvotes: 0
Reputation: 1376
VersionNumber
Upvotes: 8
Reputation: 575
Upvotes: 22
Reputation: 243
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
Upvotes: 4
Reputation: 499
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.
Upvotes: 2
Reputation: 2033
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.
Upvotes: 0
Reputation: 9
I had installed the node version I wanted, but couldn't set it with nvm use [version]
in Powershell. This worked for me:
sudo nvm use [version]
.Upvotes: 0
Reputation: 346
I 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.
Upvotes: 27
Reputation: 86
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:
Upvotes: 0
Reputation: 671
I 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.
Upvotes: 0
Reputation: 41
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 :)
https://github.com/coreybutler/nvm-windows/releases/download/1.1.7/nvm-setup.zip
Upvotes: 4
Reputation: 17
It Solve my issue in windows
Upvotes: -2
Reputation: 111
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.
Upvotes: 10
Reputation: 1638
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.
Upvotes: 152
Reputation: 7286
Upvotes: 25