在我的 Angular-12 应用程序中,我尝试使用以下命令生成服务:
ng gs 身份验证/服务/登录
但我得到了这个错误:
ng : File C:\Users\akweey\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 g s auth/services/login
+ ~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
Run Code Online (Sandbox Code Playgroud)
当我检查路径:C:\Users\akweey\AppData\Roaming\npm\ng.ps1时,
我只找到了 ng 但没有找到 ng.ps1
我该如何解决这个问题?
谢谢
Dra*_*iya 127
出现此问题的原因是未定义执行策略。
在 Powershell 中尝试以下命令:
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted
Run Code Online (Sandbox Code Playgroud)
在 powershell 上执行此操作,
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted
Run Code Online (Sandbox Code Playgroud)
接下来,“您想更改执行策略吗?” 对所有人说“是”
A
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
86556 次 |
最近记录: |