我开始学习Angular,但我注意到在Windows中使用PowerShell时,每当我执行类似Angular命令的时候会出现错误。
这是我得到的错误信息:
P.S. 我在命令提示符中尝试了这些命令,它们有效。
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
P.S. 我在命令提示符中尝试了这些命令,它们有效。
Get-ExecutionPolicy
并提供输出吗?此外,你能否转到C:\Users\<username>\AppData\Roaming\npm
并打开ng.ps1
的属性,查看是否有一个标记框,指示“已阻止”,如果是,请取消选中它。 - Jacobjavascript
语言无关,请不要添加javascript
标签。 - Mina