Installing Heroku Toolbelt on Windows 10

扶醉桌前 提交于 2019-12-04 10:32:08

问题


I've been having some issues installing the Heroku toolbelt on Windows 10, 64-bit.

It's the first time I install Heroku. I downloaded it from 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

Running the same command on Windows Powershell, what I got back was

'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.

I checked, and the Heroku folder was added to the PATH.

I thought I'd ask for some help before installing anything else.

Thank you!


回答1:


bash: heroku: command not found

The error message is clear: Bash cannot find the heroku command, it's not on your PATH.

I checked, and the Heroku folder was added to the 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:

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:

/c/Program\ Files/Heroku/bin/heroku login

If this works (and it should), then you can add it to PATH like this:

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.

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:

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



回答2:


In windows bash instead of this

PATH="$PATH:/c/Program\ Files/Heroku/bin" 

use this

 PATH="$PATH:/c/Program Files/Heroku/bin"



回答3:


My working solution (for git-bash especially) is:

alias heroku='winpty `where heroku.cmd`'

stored in .bashrc in home user dir and them

heroku

works as expected




回答4:


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.




回答5:


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.




回答6:


I know this is an old thread and just want to share my solution.

Edit .bashrc for git-bash

alias heroku='"C:\Program Files\Heroku\bin\heroku.cmd" $@'


来源:https://stackoverflow.com/questions/33908177/installing-heroku-toolbelt-on-windows-10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!