私は 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\