How to update Heroku cli?

heroku

#1

Seems everything I have tried failed to update Heroku to the latest version

First:

heroku update returns:

! To update this version of the Heroku client please use
! apt-get install heroku-toolbelt

And if I do that as per the C9 documentation (https://docs.c9.io/v1.0/docs/deploying-via-cli):

wget -O- https://toolbelt.heroku.com/install-ubuntu.sh | sh

it updates to:

heroku-toolbelt/3.43.16 (x86_64-linux) ruby/2.3.0
heroku-cli/5.2.20-9d094b0 (linux-amd64) go1.6.2

And I’m told the latest version of Heroku Cli should be:

5.6.1

Any ideas ?


#2

This is an odd one. I had a bit of a look in to this.

The TL;DR is that heroku only vends an older version via their deb packages and the update process requires writing things over the top of the packages, which they do in a way that doesn’t support layered filesystems. (namely assuming you can do a hard link across what may be different filesystems via an atomic rename instead of trying to copy the file as a fallback)

You should have gotten 5.4.8 not 5.2.20 however.

I just made another new workspace and I have this by default:

heroku-toolbelt/3.43.13 (x86_64-linux) ruby/2.3.0
heroku-cli/5.4.8-eee5ec9 (linux-amd64) go1.7.1

Running sudo apt-get update; sudo apt-get install heroku-toolbelt heroku gets me:

heroku-toolbelt/3.43.16 (x86_64-linux) ruby/2.3.0
heroku-cli/5.4.8-eee5ec9 (linux-amd64) go1.7.1

Getting beyond that version does not appear to work when using the install-ubuntu script provided by Heroku at this time (it just adds the apt repo for heroku-toolbelt and heroku)

Sadly there doesn’t appear to be a way to fix this within a Cloud9 workspace at this time, Heroku should (eventually) release a newer version via apt at which point doing apt-get install heroku-toolbelt as they suggest will work normally.

Fun fact: the warning to only use apt-get to manage upgrades is always printed after it tries to run the update.


#3

I believe I should just uninstall and reinstall. Would you suggest doing so, because I wouldn’t want to run into more troubles ?


#4

This is frustrating. How do you uninstall and reinstall Heroku Cli, because the suggested way in Heroku Docs does nothing:

$ sudo apt-get remove heroku-toolbelt
$ sudo rm /etc/apt/sources.list.d/heroku.list

Say it’s uninstalled yet heroku --version returns:

heroku-toolbelt/3.43.16 (x86_64-linux) ruby/2.3.0
heroku-cli/5.2.20-9d094b0 (linux-amd64) go1.6.2

Can someone list the commands or point me in the right direction ?


#5

Try running sudo apt-get purge heroku-toolbelt, should completely remove it.


#6

That gives me this error:

E: Unable to locate package heroku-toolbelt


#7

ok, so I manage to remove it with:

 sudo apt-get --purge remove heroku
 sudo apt-get --purge remove heroku-toolbelt

But when reinstalling it reinstall the presumably same old version, either I install as per Heroku Docs:

sudo add-apt-repository "deb https://cli-assets.heroku.com/branches/stable/apt ./"
curl -L https://cli-assets.heroku.com/apt/release.key | sudo apt-key add -
sudo apt-get install heroku

Or with:

wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh


#9

So, the solution is this, via Heroku support team:

remove the directory ~/.local/share/heroku/ and then run heroku update or in my case wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh

(Removing this directory will cause the CLI to download the latest version)


#10

I’m having this same problem. But the solution listed in the last comment here gives me a message that heroku-toolbelt is already in the latest version. Alas, my toolbelt version is 5.4.8.

Any new developments on this problem?


#11

(I’m the maintainer of the Heroku CLI)

Cloud9 is using the legacy toolbelt which is a few major revisions behind our current CLI. Use our apt-get script to update the CLI:

$ wget -qO- https://cli-assets.heroku.com/install-ubuntu.sh | sh

#12

@dickeyxxx using that script breaks apt on cloud9, because apt refuses to do anything, when there is something using https in sources.list.d and apt-transport-https is not installed Installing apt-transport-https issue

running

sudo apt-get update
sudo  apt-get install -y apt-transport-https

before echo "deb https://cli-assets.heroku.com/branches/stable/apt ./" > /etc/apt/sources.list.d/heroku.list, works.


Installing apt-transport-https issue
#13

thanks for letting me know, I’ll update the script. Probably see if I can have it first check if apt-transport-https is installed


#14

this is now updated with the fixed transport


#15

This has been a while and I found that the issue still exists.

I tried the script you guys mentioned to do the update. The results is

E: The method driver /usr/lib/apt/methods/https could not be found.
N: Is the package apt-transport-https installed?

Then I tried manually to update heroku. I got messages below:

The following packages have unmet dependencies:
apt-transport-https : Depends: libapt-pkg4.12 (>= 1.0.9.8.4) but 1.0.1ubuntu2.10 is to be installed
Depends: libstdc++6 (>= 4.9) but 4.8.4-2ubuntu1~14.04.3 is to be installed
E: Unmet dependencies. Try ‘apt-get -f install’ with no packages (or specify a solution).
These two packages have a huge dependent relationship and I could not simply remove them.

Can anyone suggest what to do as I cannot push my app from C9 to Heroku?


#16

try using the standalone tarball


#17

Does C9 provide a way to upgrade the Heroku CLI to a supported version?

Reading this thread leads me to believe that the answer is no.

If there is a way to upgrade, can C9 support list the steps or reference a document that does?


#18

Just a quick follow-up note: I successfully upgraded using the instructions from dickeyxxx:

$ wget -qO- https://cli-assets.heroku.com/install-ubuntu.sh | sh


#19

The command provided by dickeyxxx seems to have worked fine for me as well.

$ wget -qO- https://cli-assets.heroku.com/install-ubuntu.sh | sh


#20

My rails console stopped working due to the deprecated CLI. I updated per the instructions above, but now I can’t run any rails commands. What do I need to do to? See output below:

heroku run rails console
Refreshing plugins… !
▸ semver has no commands. Is this a CLI plugin?
Refreshing plugins… done
Refreshing plugins… !
▸ semver has no commands. Is this a CLI plugin?
Refreshing plugins… done
▸ run is not a heroku command.
▸ Perhaps you meant plugins:uninstall
▸ Run heroku help for a list of available commands.

My version is:
heroku-cli/6.15.11-5cba33c (linux-x64) node-v9.3.0

Thanks in advance for any help!