powershell執行yo命令 提示 npm\yo.ps1,由於在此係統上禁止運行腳本。

執行yo命令 報錯:shell

yo : 沒法加載文件 C:\Users\aaa\AppData\Roaming\npm\yo.ps1,由於在此係統上禁止運行腳本。有關詳細信息,請參閱 https:/go
.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。
所在位置 行:1 字符: 1
+ yo tinymce
+ ~~
    + CategoryInfo          : SecurityError: (:) [],PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

如圖
20200415040728.pngnpm

打開微軟的官方文檔
https://docs.microsoft.com/zh...spa

使用命令code

Get-ExecutionPolicy -List

檢查powershell設置,看結果是不是:blog

Scope ExecutionPolicy
        ----- ---------------
MachinePolicy       Undefined
   UserPolicy       Undefined
      Process       Undefined
  CurrentUser    RemoteSigned
 LocalMachine       AllSigned

CurrentUser 若是不是 RemoteSigned 就使用命令(管理員模式ci

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

設置CurrentUser爲RemoteSigned 就能夠了。文檔

相關文章
相關標籤/搜索