Angular kann nicht geladen werden, da die ausführung von skripts auf diesem system deaktiviert ist

This error I encountered when I tried to use integrated terminal of visual studio code for executing Angular CLI commands for the first time.

Exception Details:

\AppData\Roaming\npm\ng.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at
https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1~~

CategoryInfo : SecurityError: (:) [], PSSecurityException

FullyQualifiedErrorId : UnauthorizedAccess

Problem

The issue appear to be security related exception. Also we can observe Unauthorized Access as error Id in exception details.

Angular kann nicht geladen werden, da die ausführung von skripts auf diesem system deaktiviert ist

So the issue is Visual Studio Code could not load ng.ps1 file due to security reasons. Also exception is suggesting to refer Microsoft website article as Visual Studio Code is Microsoft product.

Solution

To solve the issue I could navigate to the file and deleted the ng.ps1 file as shown in below screen shot. After deleting that file I could go ahead with Angular CLI command execution in Visual Studio Code integrated terminal.

Angular kann nicht geladen werden, da die ausführung von skripts auf diesem system deaktiviert ist

Video Tutorial

This video shows how to solve the above issue with above solution

Video Tutorial

Summary

These are some small errors which we can solve if we try to analyze the exception and apply some basic actions.

Software professional with 7+ years of experience in all phases of software development with robust problem-solving skills and proven experience in creating and designing software in a test-driven environment.

Issue Description

Angular commands like ng new or ng serve produce PowerShell commands error as below,

ng : File C:\Users\test\AppData\Roaming\npm\ng.ps1 cannot be loaded. The file C:\Users\test\AppData\Roaming\npm\ng.ps1 is not digitally signed. You cannot run this script on the current system. For more information about running scripts and
setting execution policy, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1

Angular kann nicht geladen werden, da die ausführung von skripts auf diesem system deaktiviert ist

Resolution

This issue means your machine is preventing you from running script files. Implementation of these policies occurs on Windows platforms including Windows client or Windows Server machines. The PowerShell execution policies are as follows,

  • formatting and configuration files (.ps1xml),
  • module script files (.psm1), and
  • PowerShell profiles (.ps1).

Steps to resolve the issue

To change the PowerShell execution policy on your Windows computer, use the below command

Step1: Get-ExecutionPolicy for your Machine using the below command

Get-ExecutionPolicy -List
Angular kann nicht geladen werden, da die ausführung von skripts auf diesem system deaktiviert ist

Step2: Once your identity scope and execution policy, please run the below commands using the same.

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Angular kann nicht geladen werden, da die ausführung von skripts auf diesem system deaktiviert ist

Finally, you shall be all set to run your script (without restarting the PowerShell).

Angular kann nicht geladen werden, da die ausführung von skripts auf diesem system deaktiviert ist

References :

  • Angular Architecture and Design Guidelines
  • Angular – Pass Data From Parent to Child and Child to Parent Component

Happy Coding!

Did the above steps resolve your issue?

Do you have any comments or ideas or any better suggestions to share?

Please sound off your comments below.

Happy Coding !!



Please bookmark this page and share this article with your friends. Please Subscribeto the blog to get a notification on freshly published best practices and guidelines for software design and development.


To serve the best user experience on website, we use cookies . By clicking “Accept”, you give consent to our privacy policy.