Header add

When you have to run your Angular project or any ng command, you may see that the system shows the below error:  

ng : File C:\Users\KIIT\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
+ ng new myDemoApp
+ ~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess
 

Solution

 
This error occurs when your system has disabled the running script and your system is can’t accept the ng commands. This error occurs due to security reasons and won't let the script be executed on your system without your approval. Then you have to open the PowerShell with administrative rights.
 
To solve this problem, you need to follow a few steps:
 
Step 1
 
First, you have to need to open the command prompt and run this command.

ou could try the following:

  1. set-ExecutionPolicy RemoteSigned -Scope CurrentUser 



If you are using visual studio code:


  1. Open terminal
  2. Run the command: Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted
  3. Then run the command protractor conf.js


This is related to protractor test script execution related and I faced the same issue and it was resolved like this.

Post a Comment

Previous Post Next Post