Error UnauthorizedAccess in Visual Studio Code

Recently I have started to use Visual Studio Code, and when I started to work on an Angular project, Opened the terminal,  type the commands
>npm install
The command threw an error:
"Sync\dirsync\ImportModules.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies"
 
 
I googled it and tried to find the solutions it showed some commands, but they did not work for me.
Then I opened the Visual Studio Code as administrator, and my colleague gave me a command:
"Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser"
It worked. The mistake I was doing was trying to change Execution Policy without logging as Admin.
So Always remember before updating execution rights: always login as Admin first.  then try out the solutions.
 
Hope this is helpful, Thank you.
 

Add comment