javascript - 为什么 powershell 不运行 Angular 命令?

标签 javascript angular powershell angular-cli

我已经开始学习 Angular,但我注意到 Windows 中的 powershell 每当我执行如下 angular 命令时都会出现错误:

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 中尝试了这些命令,它可以工作。

最佳答案

删除 ng.ps1来自目录C:\Users\%username%\AppData\Roaming\npm\然后尝试清除 C:\Users\%username%\AppData\Roaming\npm-cache\ 处的 npm 缓存

关于javascript - 为什么 powershell 不运行 Angular 命令?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58032631/

相关文章:

angular - 在表格组件内显示 mat-chips

git - 如何在 Powershell 提示符中右对齐某些内容?

powershell - 使用开关触发命令

javascript - 如何选择包装器中的所有元素?

php - 在 IE 中获取图像文件大小

angular - 如何在 Angular 7/Typescript 中使用变量类名?

powershell - <位置> : Missing ')' in method call. - Powershell

javascript - js动态创建点击功能的复选框未定义

javascript - Promise、fetch、codestyle。请解释 .then(checkStatus).then(parseJSON)

angular - 使用 Angular CLI 并且无法在 CSS 文件中使用相对图像路径