Heroku CLI suddenly broken - heroku

Suddenly, from one command to the next, the Heroic CLI stopped working. No matter what I type into the command line, I get the same error. See below.
$heroku help
▸ commands is not a heroku command.
▸ Perhaps you meant domains
▸ Run heroku help for a list of available commands.
! error getting commands pid 24643 exit 127
What the heck is going on?

this problem just happened with me after the last update of heroku CLI,
heroku CLI check if there is updates after execute any command related with and when run updates the problem occurs because is not working with root permissions.
to fix this you need to reinstall heroku CLI
sudo apt-get remove heroku
sudo add-apt-repository "deb https://cli-assets.heroku.com/branches/stable/apt ./"
curl -fL https://cli-assets.heroku.com/apt/release.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install heroku
and you probably need to add this path
PATH=$PATH:~/usr/bin
export PATH

This just happened to me. I fixed it by removing the heroku app the same way i installed it. I had the gem installed, so i uninstalled that.
gem uninstall heroku
Then i used homebrew to reinstall it.
brew install heroku
and it worked.

Something similar (although with a different error message) happened to me after updating my OS. On a Mac, make sure to install the CommandLineTools (with Xcode) after a major OS update!

Related

Why can't my terminal find Cocoapods commands?

I am trying to use Cocoapods, but I'm stuck with even setting it up properly. It keeps showing me
-bash: pod: command not found
and I can't do anything. Also, the
$ pod init
doesn't work. I suppose the my computer cannot find any commands related to Cocoapods.
I've followed all the ways that was listed on the Cocoapods website, and read from websites such as raywenderlich but nothing helped.
$ sudo gem install cocoapods
Successfully installed cocoapods-1.7.5
Parsing documentation for cocoapods-1.7.5
Done installing documentation for cocoapods after 2 seconds
1 gem installed
$ pod setup --verbose
-bash: pod: command not found
I expect it to clone the CocoaPods Master Specs repository into ~/.cocoapods/ on my computer. Please help.
I actually thought you'd get the "You don't have write permissions for the /usr/bin directory." error, but your successfully installing it. I'm not sure why it's installing it in and then reading from another.
Try installing in a different directory:
sudo gem install -n /usr/local/bin cocoapods
For more see here

The heroku cli fails

I run
heroku logs
and get
'ENOCOMMANDS': semver has no commands. Is this a CLI plugin?
Is there a problem with the current version of heroku? I have searched for both ENOCOMMANDS and semver with no useful results.
I had the same issue. I fixed it by uninstalling and then installing heroku like this...
$brew uninstall --force heroku
$rm -rf ~/.local/share/heroku ~/.config/heroku ~/Library/Caches/heroku
$brew install heroku

Heroku run shows update, is it necessary to update ? And if yes than how?

heroku run rails console
▸ heroku-cli: update available from 6.11.17 to 6.14.16-9ae58fc
▸ No app specified
How do I update my heroku-cli version?
You are not obligated to update. I am using a previous version as well, and everything works fine.
But if you want to update check this link: https://devcenter.heroku.com/articles/heroku-cli
It says that to update your heroku cli you just have to do this:
heroku update
But there is this issue:
Not all methods of installation are updatable with heroku update. Apt users will have to use sudo apt-get update && sudo apt-get upgrade heroku. npm/yarn users will have to update with npm upgrade -g heroku-cli or yarn global upgrade heroku-cli
If updating does not update the CLI, try uninstalling with the uninstall instructions below
heroku update
did not work for me. I had to run:
sudo apt update && sudo apt install heroku
in order to get an update.
Uninstall Heroku by using command:
sudo apt-get remove Heroku
Then install Heroku by:
sudo apt-get install heroku
Now check Heroku version:
heroku -v
I am using Windows 11 and heroku update is working properly.
Remember to run this command in the terminal as an administrator.
This is how I updated:
npm update -g heroku

-bash: pod: command not found

I am taking a course from Udemy for iOS 10 (swift 3) programming. An app works with Firebase and Firebase requires a pod file. In the course, it said to type the following commands in Terminal to install a pod:
cd Desktop/
ln
cd dc-social
ln
pod init
But when I run the pod init command, it gives me an error:
-bash: pod: command not found
I am running macOS Sierra (the final release). What should I do? Any help would be appreciated :)
Thanks!
try to run this first
(it will ask your admin password)
sudo gem install -n /usr/local/bin cocoapods
In my case I was unable to install with gem (sudo gem install cocoapods) but successfully installed with homebrew:
brew install cocoapods
I am in the same course and got the same problem. I found out that we have to install cocapods before we run that command. So do the following in your terminal (it will ask for your password):
sudo gem install cocoapods
This will install some stuff and then you will be able to run the "init pod command".
Maybe a little late, but often you can't do a sudo when your not an admin.
Then do this, open the terminal. Change to an admin user with
su 'theadminName'
Type the admin password.
Then do
sudo gem install cocoapods

Heroku command not found

After installing Heroku Toolbelt, in terminal on Mac when trying to run the following command:
heroku
I get the error:
bash: heroku: command not found
When I do:
gem environment
I get:
- RUBYGEMS VERSION: 1.3.6
- RUBY VERSION: 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin11.0]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/bin
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-11
- GEM PATHS:
- /Library/Ruby/Gems/1.8
- /Users/Bart/.gem/ruby/1.8
- /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
I've tried adding several paths to $PATH, but nothing works...
Manually adding the symlink after installing Toolbelt fixed it for me.
sudo ln -s /usr/local/heroku/bin/heroku /usr/bin/heroku
(This answer is for typical other persons, that may land here, and that may find it useful)
If you come to install heroku snap using snap command through the command line as follow
sudo snap install heroku --classic (the thing you will find in the heroku doc).
And that after installation the heroku command isn't available. Then here the solution and the why:
First know that when you install a new snap, it get added to /snap folder. A new folder with the snap name is created (/snap/heroku), and the executable file for the command is added to /snap/bin (/snap/bin/heroku).
Try
/snap/bin/heroku help
and you will find it work very well.
Solution: So you have just to add /snap/bin to your PATH environement variable.
Heroku is supposing that it's already done. I don't know, if that should have been done automatically at the installation of snapd package. But any way, that's it.
For how to add new paths to the PATH environment variable look at the links bellow, to get a good idea (case you don't know that already):
https://stackoverflow.com/a/26962251/7668448
https://askubuntu.com/questions/866161/setting-path-variable-in-etc-environment-vs-profile
https://www.computerhope.com/issues/ch001647.htm
https://hackprogramming.com/2-ways-to-permanently-set-path-variable-in-ubuntu/
http://www.troubleshooters.com/linux/prepostpath.htm
https://serverfault.com/questions/166383/how-set-path-for-all-users-in-debian
Here links about why you need to logout and login back or reboot
Setting environment variable globally without restarting Ubuntu
https://superuser.com/questions/339617/how-to-reload-etc-environment-without-rebooting
Here an example:
sudo nano /etc/environment
i chose to add the path through /etc/environment (remember you can't use shell commands).
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/node-v9.6.1-linux-x64/bin:/snap/bin
You can see i add it at the end (that simple).
Reboot your computer or logout and login back (PAM script handle the construction of the PATH from /etc/environment at session creation time)
If You want to have the effect take place right away, execute:
source /etc/environment && export PATH
(it affect only the current opened shell and the children processes)
Here another example doing it in /etc/profile:
if [ "`id -u`" -eq 0 ]; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
fi
PATH="$PATH:/snap/bin"
export PATH
I just added one line (the one before the last, and note that a portion from the whole file (/etc/profile)).
Reboot or logout and login back.
Execute :
source /etc/profile
to be operational right away (affect the current shell and the children processes).
There is different ways to add to PATH, even an infinity of ways if we give our imagination a go. The difference between the ways is about when it get set, and executed, and what scope it reach. As also organization aspect (i can have my own text list (one path per line), and have it compiled and executed in the right manner and place for example). Better see the links above, i put a good selection out there, to get a better understanding about how things work, and what method to choose. But generally the two above for a system wide configuration, are mostly what you need.
Do remember to actually source the installation file.
wget -0- wget https://toolbelt.heroku.com/install-ubuntu.sh | sh
didn't work for me. And as a linux noob I used instead:
wget 0- wget https://toolbelt.heroku.com/install-ubuntu.sh | sh
notice that the '-' is missing from the option to wget. This downloaded the install source to my current directory.
then I did:
bash install-ubuntu.sh
which finished up the installation for me.
then:
heroku login
works!!
Just run
$ gem install heroku
Form your app that's it.
I am using zsh which didn't have snap in its path. So just add this in ~/.zshrc.
export PATH=$PATH:/snap/bin
try npm install -g heroku for any platform.
Ran gem install heroku first and it gave me the following message:
heroku must be installed from cli.heroku.com. This gem is no longer available. (RuntimeError)
Steps from Heroku:
brew tap heroku/brew && brew install heroku
or Ubuntu
sudo snap install --classic heroku
when you install heroku in linux as per the documentation using
sudo snap install heroku --classic
it will install heroku inside /snap/bin/heroku
but when you type the command in terminal it will look into /usr/bin/ directory,
a simple solution is to create a symlink by
sudo ln -s /snap/bin/heroku /usr/bin/heroku
after that you can just run the heroku command in terminal.
First install heroku:
wget -qO- https://toolbelt.heroku.com/install.sh | bash
After that add a symlink to binary like #Garrett did:
sudo ln -s /usr/local/heroku/bin/heroku /usr/bin/heroku
Export snap Directory
export PATH=$PATH:/snap/bin
For yarn
If you want to deploy your backend or server, go to backend or server folder, use -
yarn global add heroku
For deploying frontend or client, go to frontend or client folder and use the same cmd.
For npm
Go to the respective folder which you want to deploy and use npm i -g heroku
After installing Heroku Toolbelt using the .pkg file I downloaded from Heroku's Getting Started with Rails 4.x on Heroku page, I got the heroku command not found message. My /usr/local/heroku/bin folder did exist.
I was able to resolve this issue by going to https://toolbelt.heroku.com and downloading the same .pkg file from that site and re-installing it. Note, I did not uninstall the previous package first.
After you run wget -0- wget https://toolbelt.heroku.com/install-ubuntu.sh | sh you might get the following warning:
WARNING: The following packages cannot be authenticated!
heroku heroku-toolbelt
If this happens, run this apt-get install -y --force-yes heroku-toolbelt
I've run all the commands with sudo, but I don't know if it makes a difference. Thanks to this answer
Brew install did not work in macOS?
For me brew tap heroku/brew && brew install heroku did not work in macOS.
So I tried the standalone download.
Here is the command which worked for me
curl https://cli-assets.heroku.com/install.sh | sh

Resources