Can't install heroku-cli. Path is missing

1.7k Views Asked by At

I've been trying to install heroku. When I run curl https://cli-assets.heroku.com/install.sh | sh on terminal I get this message : 'Your path is missing /usr/local/bin, you need to add this to use this installer.'.

I've already tried to add this to $PATH, but I'm not sure if I did it correctly. When I run echo $PATH this is what I get : '/home/rasklow/usr/local/bin:/home/rasklow/.rbenv/shims:/home/rasklow/.rbenv/bin:/home/rasklow/.rbenv/shims:/home/rasklow/.rbenv/bin:/sbin:/bin:/usr/sbin:/usr/bin:**/usr/local/bin**:/snap/bin.

Now /usr/local/bin appears to be in there, so I don't how else to install heroku. I've tried to download directly the tar.gz file but I'm fairly new to linux and I don't know how to install the package correctly.

4

There are 4 best solutions below

2
Rasklow On

As suggested in the comments

Another approach: since it looks like /snap/bin is already in your path, you may be able to use the snap based install: sudo snap install --classic heroku - davejagoda

The snap based install worked

0
allthings dev On

This is probably more like a workaround/a hack. I had the same issue on open-SUSE 15.1. When I echoed the path it showed that "/usr/local/bin/" was available on the path but still installation halted. What I did was manually adding it on the bashrc of the local user account. Basically on my .bashrc, I added this line

export PATH=$PATH:/usr/local/bin

So far everything still works, so I'm just leaving it there

0
WebDev On

Another hack which worked for me (On Amazon Linux 2) was to download the install script and after verifying that /user/local/bin was added to the path, I commented out the check in the script (lines 20-23 in the version as of 2/8/22) and then ran the script:

Step 1: download script: curl https://cli-assets.heroku.com/install.sh > ./install_heroku.sh

Step 2: add /usr/bin/local to path: export PATH=$PATH:/usr/bin/local

Step 3: Comment out the if statement on lines 20-23 of the install script (just add # to the beginning of each line)

Step 4: Run cat ./install_heroku.sh | sudo sh

0
Sixty4Bit On

The easiest way to fix this issue is to sudo to root: sudo su -

And then do the install: curl https://cli-assets.heroku.com/install.sh | sh

All of the checks will pass and no changes will need to be made. After installation, exit out of root.