Introduction
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\admin\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 --v
+ ~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : unauthorized access
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.
set-ExecutionPolicy RemoteSigned -Scope CurrentUserWhen you run this command, you can see that your system has set all policies for the current user as remotely. It will take few seconds to complete this process.
The image will be shown like below.
Now you have to go to the next step.
Step 2
Now you have to run the second command on your system. This command is:
Get-ExecutionPolicyWhen you have run this command your system has a show "RemoteSigned". If you have received this message, then your problem will be solved. Now you have to go to the next step to view the list of policy which policy has been updated by the last commands.
The image will be shown as below:

Step 3
To view their policy, you need to run this command in your command prompt:
Get-ExecutionPolicy -listWhen you run this command, a few policies are shown on your monitor screen. These policies are:

Scope ExecutionPolicy
----- ---------------
MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser RemoteSigned
LocalMachine Undefined
CurrentUser RemoteSigned
LocalMachine Undefined
Now you can see your system execution policy list. You have successfully solved your problem. Now you need to go to the command prompt and check that your problem is solved.
Now I run an ng command in my command prompt. This command is "ng --version". To check my CLI version. When I run it, the ng command the output will be shown like this:
OUTPUT

You can see that the ng command has been run successfully. Now my problem is solved.
I hope you enjoyed this article. To learn more about Angular, follow me, and to learn more technology, follow C# Corner.


KiwiFruitPosted Apr 25, 2024, 3:37 AM EDT
Thanks, helps me save lots of time
Sujit PrabhakaranPosted Feb 17, 2024, 1:25 AM EST
Just I now I ran into this error and your article save my time. So thank you from the bottom of my heart!
JamaykaPosted Feb 28, 2023, 1:57 AM EST
Thank you so much... You saved my time..
Md. ShahriarPosted Jan 21, 2023, 11:02 PM EST
Very nice....Thanks a lot....!!!
Chaman GautamPosted Dec 1, 2022, 1:20 AM EST
Thanks dear
Sarathlal SaseendranPosted Nov 30, 2022, 10:09 PM EST
Superb article. Solved my big issue today
Anil GangwarPosted Aug 30, 2022, 9:15 AM EDT
Thanks .. Great .....
Soumik MukhopadhyayPosted Jun 24, 2022, 11:30 AM EDT
Thanks. Problem solved
Dharmendra Kumar PanditPosted Apr 15, 2022, 5:35 AM EDT
Thank you working fine.... Great
Trek TreetechnoxPosted Mar 22, 2022, 6:22 AM EDT
Great job, thank you
Noura ZakiPosted Feb 17, 2022, 2:25 PM EST
Thank you! it worked
Tien TranPosted Feb 15, 2022, 9:05 AM EST
Thank you!
Dhanush KPosted Feb 1, 2022, 4:06 AM EST
Thank you!!!
Alex Sylvain LuengaPosted Jan 31, 2022, 9:59 AM EST
Ng : The term 'ng' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
George JewellPosted Jan 27, 2022, 9:54 AM EST
Thank you sir! That fixed my problem.
Muhammad SalemPosted Dec 2, 2021, 9:33 AM EST
Thanks a lot it solved my problem
Đạtt TiếnPosted Nov 17, 2021, 4:58 AM EST
Thank you, i solved my problem
Carlos AdpPosted Nov 15, 2021, 8:38 AM EST
You are great my man, you are just great!!!!! ::)))))
Prasobh PrabhakaranPosted Oct 13, 2021, 1:39 PM EDT
Thank you brother.
Syed ShahPosted Oct 8, 2021, 3:10 PM EDT
Sir its not work for me because when i opened my project using cmd then ng works and when i type ng in visual studio code then its didn't works ? i don't Know Why?
Rajesh KumarPosted Oct 4, 2021, 2:30 AM EDT
Thanks, this solved my problem
Như PhanPosted Sep 30, 2021, 5:15 AM EDT
It's so helpful, thank you very much <3
Sanjeeta KumariPosted Sep 15, 2021, 3:49 AM EDT
Thank you very much..... it worked for me .. saved my day
venkatesh mandaPosted Sep 9, 2021, 8:20 AM EDT
Thank you very much..... it worked for me .. saved my day
Krzysztof WiewióraPosted Sep 8, 2021, 5:36 AM EDT
Thank You for solution. It's work.
Matineh ShakibPosted Sep 6, 2021, 9:41 AM EDT
Good luck, u help me a lot
OM mPATILPosted Aug 25, 2021, 8:03 AM EDT
Thank you You really saved my life, I was on this of like 3 hours and was on the verge of formating my laptop
Rohi KakadPosted Aug 21, 2021, 11:27 AM EDT
Does Administrator login mandatory in order to run this command ?
Jayanti RoyPosted Aug 19, 2021, 12:23 PM EDT
Thanks a lot lot Chaman , U saved my Life of Angular :). I am new baby in angular , i was loosing hope, But your post helped me to get out of this problem. Waishe mujhe solution samaj nahi aaya ki kya kiya, but mera run ho gaya :)
Hemasandhya baskarPosted Aug 15, 2021, 11:56 AM EDT
Thank u so much ..It really helped me a lot
Sarvani LoyaPosted Aug 5, 2021, 11:06 AM EDT
Hey nice description but I m still facing issue in the step-1 itself . I am getting error like --> set-ExecutionPolicy RemoteSigned -Scope CurrentUser'set-ExecutionPolicy' is not recognized as an internal or external command,operable program or batch file.
Bhavin PandyaPosted Jul 1, 2021, 12:26 AM EDT
Thanks Chaman for your extended help for this issue. Simple but still frustrating issue. Thanks a lot.
Priya TPosted Jun 29, 2021, 1:47 PM EDT
Thanks alot . I tried to rectify these issues long hours but I couldn't .After following the simple steps here i solved it .Thanks for Sharing
super testPosted Apr 15, 2021, 5:59 PM EDT
Your the master, perfect description, thank you very much :)
syuhadah rahimPosted Feb 7, 2021, 2:55 AM EST
Hi, I've succeed till step 3. but when I want to check my CLI version “ ng --version”, Got this message: ng : ng : The term 'ng' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.At line:1 char:1+ ng --version + ~~ + CategoryInfo : ObjectNotFound: (ng:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException