Heroku 不会在 Visual Studio Code 中加载

标签 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.

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

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

最佳答案

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

您可以阅读更多关于此 here 的信息

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

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

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

Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted

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

关于Heroku 不会在 Visual Studio Code 中加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62900332/

相关文章:

node.js - 如何使用docker将应用程序发布到heroku?

node.js - 部署到heroku : Invalid end points

visual-studio-code - 在 VS Code 终端中记录 JavaScript 数组

php - 部署到 Heroku 时安装依赖项时出错

node.js - Heroku 抛出类似 "Push rejected, Unauthorized access."的错误

Laravel API 使用 Heroku Apache 路由 404 错误

node.js - NodeJS 调试在 127.0.0.1 :42457 failed: address already in use error 上启动检查器

c++ - 变量的浅蓝色突出显示

heroku-cli - 每个命令 heroku 都会失败并显示 'ENOENT' : spawn tasklist ENOENT

heroku - 如何在Termux上安装Heroku CLI?