Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Application installed by NPM (eg File C:\Users\name\AppData\Roaming\npm\ng.ps1) cannot be loaded because running scripts is disabled on this system [closed]

When running commands installed by npm (i.e. yarn, ng, etc.), I receive the following error:

File C:\Users\<username>\AppData\Roaming\npm\<application> cannot be loaded because running scripts is disabled on this system.

where <application> is one of the commands installed by npm (i.e. yarn, ng, etc.)

How can this issue be resolved?

like image 542
Esraa Alattar Avatar asked Nov 25 '20 11:11

Esraa Alattar


People also ask

How do you fix ps1 can not be loaded because running scripts is disabled on this sys?

ps1 cannot be loaded because running scripts is disabled on this system" occurs when the execution policy does not allow running the specific script on Windows. Use the Set-ExecutionPolicy -ExecutionPolicy RemoteSigned command to solve the error.

What is Appdata roaming NPM?

appdata/Roaming was made for data to roam with the user. Concrete example of this: If user A logs into machine A and npm installs, then the cache will be stored in appdata/roaming on machine A.

How do I fix Nodemon error?

Use the Set-ExecutionPolicy -ExecutionPolicy RemoteSigned command to solve the error. Open your PowerShell as an administrator and set its execution policy with the Set-ExecutionPolicy command. Copied! The Set-ExecutionPolicy command sets the PowerShell execution policy for the Windows computer.


1 Answers

I just try this command in VS terminal(PowerShell) and my problem has been solved

Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser

note : don't change CurrentUser to your username
edit : you can follow this link for changing the visual studio code terminal to cmd.exe instead of PowerShell and it will work without any security issues. https://blog.jongallant.com/2017/02/vs-code-integrated-terminal-powershell-default-change-to-cmd/

like image 89
Esraa Alattar Avatar answered Oct 23 '22 17:10

Esraa Alattar