Heroku 不会在 Visual Studio Code 中加载

Mar*_*uez 1 heroku visual-studio-code heroku-cli

heroku : File C:\Users\mar\AppData\Roaming\npm\heroku.ps1 cannot be loaded. The file C:\Users\mar\AppData\Roaming\npm\heroku.ps1 is not digitally 
signed. You cannot run this script on the current system. For more information about running scripts and setting execution policy, see 
about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
Run Code Online (Sandbox Code Playgroud)

这是我得到的错误。我试过在 cmd 中运行“heroku -v”,它在那里工作,所以我知道它安装正确。但是,当我在 Visual Studio 中运行相同的命令时,出现上述错误。我在管理模式下运行 Visual Studio 代码,我也从管理模式安装了 heroku。

我还在我的电脑设置中启用了开发者模式。

Y4g*_*ory 5

无论您是否以管理员模式运行 PowerShell,您都需要设置执行策略。

您可以在此处阅读有关此内容的更多信息

您还可以看到它在执行策略方面引发错误。该错误基本上意味着 Windows 无法验证创建脚本的用户的身份并阻止您运行它,因为它可能是有害的(基于它无法验证文件创建者的身份的事实)。

这只是防止恶意脚本自动运行的对策。

如果你想运行脚本,我建议运行

Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted
Run Code Online (Sandbox Code Playgroud)

然后运行 ​​Heroku 命令。上述脚本取消了对当前登录用户的脚本执行的限制。