Vscode: Running a command with administrator rights?

Created on 8 Jun 2016  路  8Comments  路  Source: microsoft/vscode

  • VSCode Version: 1.2.0
  • OS Version: Windows 10

Steps to Reproduce:

  1. Open terminal
  2. Npm install -g whateverpack

npm ERR! code EPERM
npm ERR! code -4048
npm ERR! syscall mkdir

How do I run command with administrator rights?
ruby

Most helpful comment

Well, I just thought of running visual studio code as administrator. Did work without running any weird command :)

All 8 comments

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" 

See http://stackoverflow.com/a/12401075/1156119

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mariusa picture mariusa  路  219Comments

TurkeyMan picture TurkeyMan  路  411Comments

stoffeastrom picture stoffeastrom  路  380Comments

Perkovec picture Perkovec  路  191Comments

ozsay picture ozsay  路  247Comments