bash 在 Windows 10 上安装 Heroku Toolbelt
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33908177/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Installing Heroku Toolbelt on Windows 10
提问by Sammy I.
I've been having some issues installing the Heroku toolbelt on Windows 10, 64-bit.
我在 64 位 Windows 10 上安装 Heroku 工具带时遇到了一些问题。
It's the first time I install Heroku. I downloaded it from https://toolbelt.heroku.com/windows.
这是我第一次安装 Heroku。我从https://toolbelt.heroku.com/windows下载了它。
After installing, I tried launching a new Git Bash and typing heroku login
but what I got back was bash: heroku: command not found
安装后,我尝试启动一个新的 Git Bash 并输入,heroku login
但我得到的是bash: heroku: command not found
Running the same command on Windows Powershell, what I got back was
在 Windows Powershell 上运行相同的命令,我得到的是
'MYSQL' is not recognized as an internal or external command,
operable program or batch file.
'MYSQL' is not recognized as an internal or external command,
operable program or batch file.
Any suggestions? I thought that googling those lines would help, but I haven't found much.
有什么建议?我认为谷歌搜索这些行会有所帮助,但我没有找到太多。
I followed the recommendation from here, but now when typing heroku login
on the Powershell, nothing happens. Nothing changes on the Git Bash.
我遵循了此处的建议,但是现在在heroku login
Powershell 上键入时,没有任何反应。Git Bash 没有任何变化。
I checked, and the Heroku folder was added to the PATH.
我查了一下,Heroku 文件夹被添加到了 PATH 中。
I thought I'd ask for some help before installing anything else.
我想在安装其他任何东西之前我会寻求一些帮助。
Thank you!
谢谢!
回答by janos
bash: heroku: command not found
bash:heroku:找不到命令
The error message is clear: Bash cannot find the heroku
command, it's noton your PATH
.
错误消息很明确:Bash 找不到heroku
命令,它不在您的PATH
.
I checked, and the Heroku folder was added to the PATH.
我查了一下,Heroku 文件夹被添加到了 PATH 中。
It seems you didn't check it correctly.
Note that even if it looks correct in the PATH
settings window,
Git Bash might have a different PATH
configured.
To see the PATH
in Git Bash, run:
看来你没有正确检查它。请注意,即使在PATH
设置窗口中看起来正确,Git Bash 也可能具有不同的PATH
配置。要查看PATH
Git Bash 中的 ,请运行:
echo $PATH
When debugging path issues,
it's best to first run heroku
with the absolute path. For example if it's in C:\Program Files\Heroku\bin\heroku
then you can run in Git Bash with:
调试路径问题时,最好先heroku
用绝对路径运行。例如,如果它在,C:\Program Files\Heroku\bin\heroku
那么你可以在 Git Bash 中运行:
/c/Program\ Files/Heroku/bin/heroku login
If this works (and it should),
then you can add it to PATH
like this:
如果这有效(并且应该),那么您可以将其添加为PATH
:
PATH="$PATH:/c/Program\ Files/Heroku/bin"
Note that Heroku will likely need other programs too on the PATH
,
such as MySQL and Ruby.
Find their absolute paths,
and add there directories to PATH
the same way as heroku
itself in the above example.
请注意,Heroku 可能还需要其他程序PATH
,例如 MySQL 和 Ruby。找到它们的绝对路径,并在上面的示例中PATH
以与heroku
自身相同的方式添加目录。
If instead of Git Bash,
you want to work in CMD,
the procedure is the same,
but the syntax to print and set PATH
is different:
如果你想在 CMD 中工作而不是 Git Bash,过程是相同的,但打印和设置的语法PATH
不同:
echo %PATH%
set PATH="C:\Program Files\Heroku\bin;%PATH%"
回答by Serge Nikolaev
In windows bash instead of this
在 windows bash 而不是这个
PATH="$PATH:/c/Program\ Files/Heroku/bin"
use this
用这个
PATH="$PATH:/c/Program Files/Heroku/bin"
回答by SlaWitDev
My working solution (for git-bashespecially) is:
我的工作解决方案(尤其是git-bash)是:
alias heroku='winpty `where heroku.cmd`'
stored in .bashrc in home user dir and them
存储在家庭用户目录中的 .bashrc 和它们
heroku
works as expected
按预期工作
回答by Bhaskar J.T
In Control Panel\All Control Panel Items\System
(if you are using Windows), go to Advanced system settings
, and there in Environment Variables
, you'll find two lists, on the same window, viz. System variables
, and User variables for your system
. Make sure you add your path, viz. C:/Program Files/Heroku/bin
, in both of these lists.
在Control Panel\All Control Panel Items\System
(如果您使用的是 Windows)中,转到Advanced system settings
,然后在 中Environment Variables
,您会在同一个窗口中找到两个列表,即。System variables
,和User variables for your system
。确保添加路径,即。C:/Program Files/Heroku/bin
, 在这两个列表中。
回答by ZenVentzi
If using bash from VSCode, I had to restart VSCode, after installing heroku. If not using VSCode, you probably need to restart your bash terminal, after installing heroku.
如果从 VSCode 使用 bash,我必须在安装 heroku 后重新启动 VSCode。如果不使用 VSCode,您可能需要在安装 heroku 后重新启动 bash 终端。
回答by Zoric
I know this is an old thread and just want to share my solution.
我知道这是一个旧线程,只想分享我的解决方案。
Edit .bashrcfor git-bash
为 git-bash编辑.bashrc
alias heroku='"C:\Program Files\Heroku\bin\heroku.cmd" $@'