Installing Heroku Toolbelt on Windows 10
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%"
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
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.
In windows bash instead of this
PATH="$PATH:/c/Program\ Files/Heroku/bin"
use this
PATH="$PATH:/c/Program Files/Heroku/bin"