49

Following this heroku tutorial to launch an app on heroku. But when I use the command heroku create, it says it's not recognized. I added C:\Program Files\Heroku to my PATH. How do I fix this?

James Mitchell
  • 2,387
  • 4
  • 29
  • 59
  • same sh*t here. I tried from git bash&cmd, windows cmd and node prompt...Any progress on your part? – curveball Mar 02 '17 at 00:40
  • I tried using $heroku it is not working. then I directly type heroku and it's working now. – unidha Jun 04 '17 at 07:04
  • Any updates? The proper directories are added to my PATH and I reopened my PowerShell window. Additionally, I restarted my computer but alas, it still does not recognize Heroku as a command. – hyperupcall Jul 17 '18 at 06:40
  • For some reason my PATH was set to `C:\Program Files (x86)\heroku\bin` altough the correct path was `C:\Program Files\heroku\bin`. That fixed the problem – O-9 Mar 29 '20 at 16:15
  • 1
    This problem usually occurs when you download the CLI, through whatever means, and don't refresh the command prompt you are using. – to240 Jan 09 '21 at 20:53

32 Answers32

38

You're probably using an old version or the deprecated package 'heroku-cli'. The new one is just called 'heroku' Uninstall that by

npm uninstall -g heroku-cli

Then install the new package

npm i -g heroku

And now all your works will go perfectly.Just try heroku login and any other heroku command.

Credit: https://github.com/heroku/cli/issues/855#issuecomment-394758388

Maniruzzaman Akash
  • 4,610
  • 1
  • 37
  • 34
27

You can follow the Getting Started on Heroku with Python .

My Heroku.exe PATH is in C:\Program Files\Heroku\bin .

Make sure your Heroku's Path is correct.

Or you can re-install the heroku.

soysoy
  • 289
  • 2
  • 10
16

1.Set the Path in environment variables.

2.I created a separate path: Variable name : Heroku, Variable Path as C:\Program Files\Heroku\bin. But it didn't work

3.so i added the same path in Path variable which is already created and it worked.

4.My Heroku.exe PATH is in C:\Program Files\Heroku\bin . Make sure your Heroku's Path is correct. Hope it helps.

enter image description here

AMIT SAMOTA
  • 385
  • 4
  • 4
16

I had this problem, after installing the heroku cli, i had to restart my commend prompt for a quick fix

9

Just add C:\Program Files\heroku\bin to your Environment Variables.

enter image description here

Make sure to close and re-open the shell or cmd.

vaheeds
  • 2,594
  • 4
  • 26
  • 36
7

I had similar problem. But closing old command prompt and opening new command prompt worked for me.

user123456
  • 186
  • 2
  • 3
5

After installed heroku, just close the vs code. Reopen vs code, on the terminal type,

heroku --version
dinokv
  • 81
  • 1
  • 3
4

In my case Restarting the IDE fixed.

2

Based on the documentation, This installation method is required for users on ARM and BSD. You must have node and npm installed already. So just install the package using npm.

 npm install -g heroku

Then in your terminal, type heroku --version will surely work fine.

Justin Herrera
  • 526
  • 4
  • 11
1

I can see the same issue with Windows 10 Home.

  • Open Windows Powershell
  • type $env:PATH

Is your Heroku path actually there? If not follow these steps:

  • Open the Start Search, type in “env”, and choose “Edit the system environment variables”
  • Click the “Environment Variables…” button

Now check values for your Heroku inside both "User" and "System" "Path" variables.

Add your Heroku path where not listed. Works immediately with no any system restart.

1

Go to bin directory and run heroku application and then type "heroku login " for login or other commands

Really don't know why Powershell not identifying Heroku ,but the above hint will work.

1

I faced this issue when I tried heroku command inside a command line window that was opened prior to installing the heroku CLI.

Simply running the command in a new command line window solved it for me.

Abhishek Poojary
  • 749
  • 9
  • 10
1

Use this it works for me "C:\Program Files\heroku\bin\heroku.cmd" create

Chandan Malla
  • 481
  • 5
  • 14
1

I encountered this issue. I closed all existing command prompt/terminal and opening new command prompt, it did the work.

donbonbon
  • 81
  • 1
  • 8
1
  1. Download heroku CLI from here
  2. Install it
  3. Close all the terminal tabs and restart your IDE Boom
Aditya Rajgor
  • 953
  • 8
  • 14
1

It worked with git bash.

Run this command:

npm install -g heroku

on git bash, then try heroku login on bash.

Bharel
  • 23,672
  • 5
  • 40
  • 80
  • I followed the other steps (involving environment variables), but those did not fix it for me. This one works and allows us to quickly upgrade the CLI! – David Zwart Jul 10 '22 at 07:04
0

If anyone experiencing this error with 'C:\Program' not recognized with heroku pg:psql -c then just do :

echo "yourcommand" | heroku pg:psql
repo
  • 748
  • 1
  • 8
  • 19
0

Install Heroku CLI through Scoop and you would be able to solve your issue

0

Set the path in Environment variables.

C:\Program Files\Heroku\bin

After setting path, still the same errors occurs.

Restart the system and sometimes this happens. Try this also if setting path didn't work.

Srinivasan N
  • 733
  • 8
  • 9
0

oh no worries u may have forgotten the path or haven't installed heroku yet

npm install -global heroku

or try deleting the previously depreciated package and reinstall it again

npm uninstall -global heroku-cli
0

Re-installing Heroku CLI works. If not, configure in environment variables

Sourav
  • 11
  • 2
0

Try going to My computer-> Properties -> advanced System Settings

In the advanced System Settings, go to

Environment variables

Path edit

new

C:\Program Files\heroku\bin

This is working for me.

Kirby
  • 15,127
  • 10
  • 89
  • 104
Iftakher
  • 1
  • 1
0

Late arrival tip: if you have a separate administrator account (which you use to install new products), note that it probably added the path to your admin account but not your other account(s), which you actually intend to run it from. Add the path to the "system variables" section instead of the admin user section.

JamieB
  • 703
  • 1
  • 6
  • 17
0

If you have checked in PATH that C:\Program Files\Heroku\bin is set. You need to close and reopen your terminal again

Arba
  • 95
  • 9
0

There was another post here Heroku won't load within Visual Studio Code I did that and it worked for me. After uninstalling and npm i -g heroku

Krad
  • 21
  • 6
0

I had the same problem

install Heroku from official site. close the terminal and open it again

type heroku --version

0

If your environment variable path is ok just refresh your terminal and it will work. I had the same issue and it worked for me.

-1

In my case closing and reopening VS code and terminal worked.

-1

Close the command prompt and open it again. That fixed my issue.

AfriPwincess
  • 123
  • 1
  • 6
-1

Just restart the the PC after setting the path.. It should work.

-1

This worked for me:

$'curl https://cli-assets.heroku.com/install.sh | sh' 
Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
-2

For me I was not in the root folder cd .. out of the proj

questerstudios
  • 111
  • 1
  • 6