【问题标题】:ng new firstapp in angular8ng new firstapp in angular 8
【发布时间】:2023-03-28 11:55:01
【问题描述】:

您好,我想开始一个新的 Angular 项目,但我遇到了以下问题。 请指导我。

错误提示

Error message: ng: File C: \ Users \ installer \ AppData \ Roaming \ npm \ ng.ps1 cannot be loaded. 
The file C: \ Users \ installer \ AppData \ Roaming \ npm \ ng.ps1 is not digitally signed. 
You cannot run this script on the current system. 
For more information about running scripts and setting execution policy, 
see about_Execution_Policies at https: /go.microsoft.com/fwlink/? LinkID = 135170. 
At line: 1 char: 1 + ng new firstapp + ~~ + CategoryInfo: SecurityError: (:) [], 
PSSecurityException + FullyQualifiedErrorId: UnauthorizedAccess.

【问题讨论】:

  • 尝试使用具有管理员权限的cmd,如果它可以工作
  • 欢迎来到 Stack Overflow!请带上tour,环顾四周,通读help center,尤其是How do I ask a good question? 邮政编码、错误消息、标记等。作为文本,而不是作为图片的文字。为什么:meta.stackoverflow.com/q/285551/157247
  • 如果你刚刚开始,你可能想从 Angular 9 开始。
  • 错误信息:ng:文件C:\Users\installer\AppData\Roaming\npm\ng.ps1无法加载。文件 C:\Users\installer\AppData\Roaming\npm\ng.ps1 没有数字签名。您不能在当前系统上运行此脚本。有关运行脚本和设置执行策略的更多信息,请参阅 https:/go.microsoft.com/fwlink/? 上的 about_Execution_Policies LinkID = 135170。在行:1 char:1 + ng new firstapp + ~~ + CategoryInfo: SecurityError: (:) [], PSSecurityException + FullyQualifiedErrorId: UnauthorizedAccess。我以管理员身份运行。

标签: javascript angular


【解决方案1】:

我最近开始遇到这个问题,我发现你需要在 powershell 上运行它

 Set-ExecutionPolicy RemoteSigned

执行策略有助于保护您免受您不信任的脚本的侵害。更改执行策略可能会暴露 请注意 about_Execution_Policies 帮助主题中描述的安全风险 https://go.microsoft.com/fwlink/?LinkID=135170。是否要更改执行策略? [Y] 是 [A] 全部是 [N] 否 [L] 全部否 [S] 暂停 [?] 帮助(默认为“N”):是

然后回答为Y

查看这个?answer了解更多信息

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-10-02
    • 1970-01-01
    • 2020-06-08
    • 1970-01-01
    • 2019-07-24
    • 2022-12-01
    • 2023-02-05
    • 1970-01-01
    相关资源
    最近更新 更多