なぜPowerShellはAngularコマンドを実行しないのですか? 質問する

なぜPowerShellはAngularコマンドを実行しないのですか? 質問する

私は Angular を学び始めましたが、次のような Angular コマンドを実行するたびに 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

PS: cmd でこれらのコマンドを試してみましたが、うまくいきました。

ベストアンサー1

ng.ps1ディレクトリから削除しC:\Users\%username%\AppData\Roaming\npm\、npmキャッシュをクリアしてみてください。C:\Users\%username%\AppData\Roaming\npm-cache\

おすすめ記事