我已经开始学习 Angular,但我注意到 Windows 中的 powershell 每当我执行如下 angular 命令时都会出现错误:
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 中尝试了这些命令,它可以工作。
最佳答案
删除 ng.ps1
来自目录C:\Users\%username%\AppData\Roaming\npm\
然后尝试清除 C:\Users\%username%\AppData\Roaming\npm-cache\
处的 npm 缓存
关于javascript - 为什么 powershell 不运行 Angular 命令?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58032631/