node.js - 安装后无法识别 Heroku CLI 命令

标签 node.js windows git heroku heroku-toolbelt

我已经安装了 Heroku CLI 和 git。安装后,我重新启动了命令提示符。当我运行 git 命令时,这些命令被识别得很好。但是,当我输入 Heroku 命令(如 heroku version)时,它们无法被识别。

所以我将路径变量设置为指向 Heroku 安装。现在,Heroku 命令可以正常工作,但 git 命令无法识别。

实际问题是什么?

这里是cmd提示内容。

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\Deva 5>git config --list
core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
diff.astextplain.textconv=astextplain
rebase.autosquash=true
credential.helper=manager
user.email=****
user.name=****
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
core.hidedotfiles=dotGitOnly
gui.wmstate=normal
gui.geometry=888x427+150+150 171 192

C:\Users\Deva 5>heroku version
'heroku' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\Deva 5>heroku login
'heroku' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\Deva 5>set path="C:\Program Files\Heroku\bin"

C:\Users\Deva 5>heroku version
heroku-cli: Updating to 6.13.1-7bcaf87... 11.6 MB/11.6 MB
heroku-cli/6.13.1-7bcaf87 (windows-x64) node-v8.2.1

C:\Users\Deva 5>git config --list
'git' is not recognized as an internal or external command,
operable program or batch file.

最佳答案

set path="C:\Program Files\Heroku\bin"

通过这样做,您替换您的 PATH 变量以包含该路径。所以你基本上破坏了其他一切。

您通常做的是将新路径追加或添加到 PATH 变量,例如像这样:

set PATH=%PATH%;C:\Program Files\Heroku\bin

永久的解决方案是编辑您的 Windows 以默认包含 Heroku 可执行文件的路径。有关更多信息和说明,请参阅 SuperUser 上的此问题:What are PATH and other environment variables, and how can I set or use them?

关于node.js - 安装后无法识别 Heroku CLI 命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45317517/

相关文章:

node.js - Sequelize查询执行顺序错误

node.js - 永远使用;如何找到子进程的pid?

windows - 在 Windows 上安装 secp256k1 库时出错

javascript - 为什么我对 server.js 的 get 请求返回 ionic - cloud 9 上的实际文件

node.js - 为什么当我调用 client.connect() 时 node-postgres (pg) 挂起?

windows - 在 Windows 中跨本地文件系统的 GIT 克隆 repo

windows - 强制 GetKeyNameText 为英文

git - 将 Mercurial 文件夹转换为 Git 存储库

git - Git 存储库中的 Mercurial "submodule"

git - Jenkins 无法从安装在同一台服务器上的 git 存储库中获取,在 box 上成功执行命令