创建一个新的Angular应用程序

时间:2020-11-02 13:55:42

标签: angular

通过运行命令“ ng new my-app”创建新的Angular应用程序时

\ ng:无法加载文件C:\ Users \ DELL \ AppData \ Roaming \ npm \ ng.ps1,因为此系统上的运行脚本已禁用。欲获得更多信息, 请参阅https://go.microsoft.com/fwlink/?LinkID=135170上的about_Execution_Policies。 在第1行:char:1

+ ng new my-app
+ ~~
   + CategoryInfo          : SecurityError: (:) [], PSSecurityException
   + FullyQualifiedErrorId : UnauthorizedAccess

该如何解决?

3 个答案:

答案 0 :(得分:0)

我找到了解决方案:- 删除ng.ps1(遵循路径),然后从漫游中删除npm-cache然后刷新。

答案 1 :(得分:0)

转到终端上提到的目录(ng:文件 C:\Users\DELL\AppData\Roaming\npm)并从此目录中删除 ng.ps1(power shell) 文件。 并再次尝试创建项目。它肯定会起作用。 here is the proof for error

答案 2 :(得分:-5)

转到建议的链接,阅读文档,然后以admin和set__Execution_Policies的身份打开PowerShell。

相关问题