为什么Powershell无法运行Angular命令? [英] Why powershell does not run Angular commands?

查看:316
本文介绍了为什么Powershell无法运行Angular命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开始学习Angular了,但是我注意到Windows中的powershell每当执行如下的Angular命令时都会给我一个错误:

I have started to learn Angular but I note that powershell in Windows gives me an error whenever I make an angular command like:

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

P.S.我在cmd中尝试了这些命令,并且有效.

P.S. I try these commands in cmd and it works.

推荐答案

从目录C:\Users\%username%\AppData\Roaming\npm\中删除ng.ps1,然后尝试清除C:\Users\%username%\AppData\Roaming\npm-cache\

Remove ng.ps1 from the directory C:\Users\%username%\AppData\Roaming\npm\ then try clearing the npm cache at C:\Users\%username%\AppData\Roaming\npm-cache\

这篇关于为什么Powershell无法运行Angular命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆