cnpm : 无法加载文件 C:\Users\ZM\AppData\Roaming\npm\cnpm.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=1351 70 中的 about_Execution_Policies。

报错详情:

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,回车

完成
参考about_execution_policies

posted @ 2019-12-31 10:32  ellenxx  阅读(1051)  评论(0编辑  收藏  举报