Steps to Reproduce:
npm ERR! code EPERM
npm ERR! code -4048
npm ERR! syscall mkdir
How do I run command with administrator rights?
It should work just like a non-administrator cmd, you can apparently run one off admin commands like:
runas.exe /savecred /user:administrator "%sysdrive%\testScripts\testscript1.ps1"
Well, I just thought of running visual studio code as administrator. Did work without running any weird command :)
If someone is like me being confused why this isn't working, one caveat I ran into was that I had to close all instances of VS Code to get this to work first.
So I tried a bunch of these solutions and none of them really worked for me. I had to use regular old command line with admin rights to get it working. I didn't try it with powershell though - I use git bash as my default terminal for visual studio. Is there something else you have to do to run git bash with admin rights?
@LPsyCongroo Did you try running vscode as administrator? I was having problems with it until doing that. The terminal it is using is powershell
Use the command from cmd while running cmd with Administrator privileges, this wroks for me on windows.
Linux add a "sudo" before the command!
@DaveyEdwards Yes, I tried doing that (using a number of ways). I think the problem was with Git Bash specifically - I had trouble running the stand alone terminal with admin rights as well. I got it working eventually just using cmd with admin rights and I think others on this thread were using powershell. I just personally like Git Bash and was hoping to be able to use my preferred in-editor terminal to install my NPM packages.
Yes the problem is with GitBash i noticed earlier too.
Most helpful comment
Well, I just thought of running visual studio code as administrator. Did work without running any weird command :)