我已经开始学习ANGLE,但我注意到,每当我执行ANGLE命令时,Windows中的PowerShell都会给我一个错误:
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中尝试了这些命令,它起作用了。
5条答案
按热度按时间wb1gzix01#
从目录
C:\Users\%username%\AppData\Roaming\npm\
中删除ng.ps1
,然后尝试清除C:\Users\%username%\AppData\Roaming\npm-cache\
处的NPM缓存xj3cbfub2#
我在指挥之下跑来跑去解决了我的问题
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
ltqd579y3#
无法加载script1.ps1,因为此系统上禁用了运行脚本。有关详细信息,请参阅http://go.microsoft.com/fwlink/?LinkID=135170上的关于_EXECUTION_POLICES
发生此错误的原因是安全措施不允许在未经您批准的情况下在您的系统上执行脚本。为此,您可以打开具有管理权限的PowerShell(在主菜单中搜索PowerShell,然后从上下文菜单中选择以管理员身份运行),然后输入:
kzipqqlq4#
第一步
首先,您需要打开命令提示符并运行此命令。
set-ExecutionPolicy RemoteSigned -Scope CurrentUser
第二步
现在,您必须在系统上运行第二个命令。此命令为:
Get-ExecutionPolicy
第三步
要查看他们的策略,您需要在命令提示符中运行以下命令:
Get-ExecutionPolicy -list
https://www.c-sharpcorner.com/article/how-to-fix-ps1-can-not-be-loaded-because-running-scripts-is-disabled-on-this-sys/
flmtquvp5#
打开Windows PowerShell,以管理员身份运行,并以不受限制的身份设置执行策略,然后它将工作。