Resolving PS1 Error: Enabling Angular Commands in PowerShell

If you get this error while running the ng-script in Powershell: 
Error: ng : ….\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.LinkID=135170……..

Few Steps to follow:
Step 1: Open your terminal and type the below syntax:

set-ExecutionPolicy RemoteSigned -Scope CurrentUser

This command set the policies for the current user.

Step 2: Now the second command is:

Get-ExecutionPolicy

After running this command, it will show “RemoteSigned”.
If the RemoteSigned message is received then the problem is resolved.

Step 3: To view the Policy, we need to run the below command:

Get-ExecutionPolicy -list

The policies are:

We can see CurrentUser policy changes to RemoteSigned.

We have successfully solved the problem. Now try to run the “ng version” angular command in the terminal.

Inside the Powershell terminal, the ng command is working.

Conclusion
By following the above steps and writing the syntax in a proper way, you can resolve the PowerShell1(PS1) error.

Good Luck!!!

Comments

Popular posts from this blog

Validating Date of Birth in Angular Reactive Form: Best Practices and Examples

Understanding Node.js Event Emitter: A Powerful Event Handling Mechanism

Convert JSON to CSV with Node.js using readFileSync