Heroku command not found

前端 未结 12 1053
北海茫月
北海茫月 2021-02-01 03:06

After installing Heroku Toolbelt, in terminal on Mac when trying to run the following command:

heroku

I get the error:

bash: he         


        
相关标签:
12条回答
  • 2021-02-01 03:35

    try npm install -g heroku for any platform.

    0 讨论(0)
  • 2021-02-01 03:36

    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!!

    0 讨论(0)
  • 2021-02-01 03:37

    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
    
    0 讨论(0)
  • 2021-02-01 03:38

    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

    0 讨论(0)
  • 2021-02-01 03:40

    Manually adding the symlink after installing Toolbelt fixed it for me.

    sudo ln -s /usr/local/heroku/bin/heroku /usr/bin/heroku

    0 讨论(0)
  • 2021-02-01 03:42

    (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.

    0 讨论(0)
提交回复
热议问题