Introduction
After installing Angular CLI
on my PC, I then attempt to lunch an Angular project using ng serve –o
…. Boom this is what I saw
Frustrating right?
This has to do with restrictions built into the operating systems that disable the running of a script for security reasons. So to run any script at all, you must change the permission through PowerShell to allow the script.
Follow the step below to solve the problem
Step 1: Open Windows PowerShell (Admin)
Do this by right-clicking on the windows logo on the bottom left corner of your screen.
Click on Windows PowerShell (Admin) as listed in the options displayed to lunch the PowerShell
Step 2: Know the script execution policy option available
There are four execution policy options you can select from. This includes;
• Restricted
– No scripts can be run.
• AllSigned
– Only scripts signed by a trusted publisher can be run.
• RemoteSigned
– Only runs downloaded scripts signed by a trusted publisher.
• Unrestricted
– All scripts can be run.
Step 3: Change permission
The PowerShell script execution policy is default set to Restricted. To change it to RemoteSigned
for instance, run the command below in the PowerShell
Set-ExecutionPolicy RemoteSigned
Note: There might be a warning message to inform you about the implication of changing the execution policy, type-in A
to accept and proceed.
Finally, confirm the active execution policy by running the get-executionpolicy
command. This displays RemoteSigned
as a reply.