Resolved! | npm\ng.ps1 cannot be loaded because running scripts is disabled on this system.

On sunning the npm scripts in the Visual Studio code you may face an error saying:

This Angular tutorial is compatible with version 4+ including latest version 12, 11, 10, 9, 8 ,7, 6 & 5.

ng : ~\npm\ng.ps1 cannot be loaded because running scripts is disabled on this system.

This happens as your system, power shell is not yet allowed to execute any executable scripts. This error is encountered mainly in Windows 10 when using VS Code IDE where Power Shell is selected as a command-line option by default.

Solution

Step 1) Execute the following CMD command in the same Powershell terminal

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

You can check more details here. As a quick solution, we’re allowing for Current User.

Step 2) This is a very important step, make sure you close all CMD and VS Code instances to reflect the changes.

 

That’s it …. you are done 🙂

3 Replies to “Resolved! | npm\ng.ps1 cannot be loaded because running scripts is disabled on this system.

Leave a Reply

Your email address will not be published. Required fields are marked *