Installing Heroku Toolbelt on Windows 10

冷暖自知 提交于 2019-12-03 05:40:24

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%"

In windows bash instead of this

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

use this

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

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

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.

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.

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