hexo运行报无法加载文件 C:\Users\Administrator\AppData\Roaming\npm\hexo.ps1

如果运行hexo s 报以下错误

无法加载文件 C:\Users\Administrator\AppData\Roaming\npm\hexo.ps1,因为在此系统中禁止执行脚本。有
关详细信息,请参阅 "get-help about_signing"。
所在位置 行:1 字符: 5
+ hexo <<<<  s
    + CategoryInfo          : NotSpecified: (:) [], PSSecurityException
    + FullyQualifiedErrorId : RuntimeException

解决如下:
Win7系统以管理员身份运行PowerShell

执行:get-ExecutionPolicy,返回状态:Restricted,表示状态是禁止的,
然后要设置下
执行:set-ExecutionPolicy RemoteSigned 开启
选择Y

注意:一定要以管理员的身份运行PowerShell,不是cmd窗口!

posted @ 2021-02-26 15:52  hdlan  阅读(1180)  评论(0编辑  收藏  举报