【window】系统禁止运行脚本

报错信息

docsify : 无法加载文件 C:\Users\laofan\AppData\Roaming\npm\docsify.ps1,因为在此系统上禁止运行脚 
本。有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。
所在位置 行:1 字符: 1
+ docsify init ./docs
+ ~~~~~~~
    + CategoryInfo          : SecurityError: (:) [],PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

官方解释: https://docs.microsoft.com/zh-cn/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7

解决办法:

需要改变RemoteSigned的执行策略
1.win10搜索 Windos PowerShell 管理员权限打开 (不是cmd,切记!)
2.设置权限

set-ExecutionPolicy RemoteSigned

选择Y即可

3.查询
输入以下查看当前的状态

get-ExecutionPolicy 

如果是RemoteSigned,则已修改成功

posted @ 2020-05-13 15:56  依然范儿特西  阅读(2019)  评论(0编辑  收藏  举报