为什么 powershell 不运行 Angular 命令? [英] Why powershell does not run Angular commands?
本文介绍了为什么 powershell 不运行 Angular 命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经开始学习 Angular,但我注意到每当我发出如下 angular 命令时,Windows 中的 powershell 都会给我一个错误:
I have started to learn Angular but I note that powershell in Windows gives me an error whenever I make an angular command like:
ng new new-app
或
ng serve
这是我得到的错误:
ng : File C:\Users\< username >\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 serve
+ ~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
附言我在 cmd 中尝试这些命令并且它有效.
P.S. I try these commands in cmd and it works.
推荐答案
从目录 C:\Users\%username%\AppData\Roaming\npm\<中删除
ng.ps1
/code> 然后尝试清除 C:\Users\%username%\AppData\Roaming\npm-cache\
Remove ng.ps1
from the directory C:\Users\%username%\AppData\Roaming\npm\
then try clearing the npm cache at C:\Users\%username%\AppData\Roaming\npm-cache\
这篇关于为什么 powershell 不运行 Angular 命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文