admin管理员组文章数量:1641322
cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft/fwlink/?LinkID=135170.
在powershell中打开angular-cli的时候,输入ng命令,收到了这个提示
ng : File C:\Users\ysu10\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/fwlink/?LinkID=135170.
At line:1 char:1
+ ng new
+ ~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
这个原因是由于脚本执行策略为严格模式,所以无法执行,可以通过
Get-ExecutionPolicy
来获取当前的脚本执行策略
默认为Restricted,要使脚本能够执行,需要修改为Unrestricted 或 Bypass.
相应的命令分别为
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted -Force
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Bypass -Force
如果设置为unrestricted,则如果执行从网上下载的未签名脚本时会询问用户。
如果设置为bypass,则会直接执行。
建议设置为unrestricted。
本文标签: runningloadedScriptsSystemdisabled
版权声明:本文标题:cannot be loaded because running scripts is disabled on this system 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dianzi/1729318509a1195591.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论