報錯詳情:
cnpm : 無法加載文件 C:\Users\ZM\AppData\Roaming\npm\cnpm.ps1,因為在此系統上禁止運行腳本。有關詳細信息,請參閱 https:/go.microsoft.com/fwlink/?LinkID=1351
70 中的 about_Execution_Policies
也就是系統上禁止運行.ps1文件。
原因:
參考about_execution_policies可知,PowerShell會限制腳本文件的運行,包括格式和配置文件(.ps1xml),模塊腳本文件(.psm1)和PowerShell配置文件(.ps1)。
解決方法:
一:
用管理員身份打開 Windos PowerShell
二:
在Windows PowerShell中更改執行政策
先輸入
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
回車
再選擇A,回車