heroku toolbeltのインストールでハマった話
Ruby on Rails チュートリアル:実例を使って Rails を学ぼうの1.4節でHerokuにデプロイするというのがありますが、色々ハマったのでメモしておきます。
CentOS6.5でHeroku Toolbeltからtoolbetをダウンロードする場合、Standaloneを選択して下に表示されたwget -qO- https://toolbelt.heroku.com/install.sh | sh
を実行すれば良いはず。なので、まずはその通りにやってみました。
[vagrant@localhost ~]$ wget -qO- https://toolbelt.heroku.com/install.sh | sh [vagrant@localhost ~]$ heroku login -bash: heroku: command not found
が、インストールされていない。。。ので、「CentOSにheroku toolbeltをインストール」が失敗する場合の対処を参考に、証明書を無視する形で実行してみました。
[vagrant@localhost ~]$ wget --no-check-certificate https://toolbelt.heroku.com/install.sh --2014-03-27 03:06:26-- https://toolbelt.heroku.com/install.sh Resolving toolbelt.heroku.com... 23.21.54.126, 23.23.227.87, 50.19.233.212 Connecting to toolbelt.heroku.com|23.21.54.126|:443... connected. WARNING: certificate common name www.heroku.comtoolbelt.heroku.cominstall.shinstall.sh [vagrant@localhost ~]$ sudo sh ./install.sh This script requires superuser access to install software. You will be prompted for your password by sudo. Add the Heroku CLI to your PATH using: $ echo 'PATH="/usr/local/heroku/bin:$PATH"' >> ~/.profile Installation complete [vagrant@localhost ~]$ echo 'PATH="/usr/local/heroku/bin:$PATH"' >> .bashrc [vagrant@localhost ~]$ cat .bashrc # .bashrc # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi # User specific aliases and functions PATH="/usr/local/heroku/bin:$PATH" [vagrant@localhost ~]$ source .bashrc
で、実行してみると
[vagrant@localhost ~]$ heroku version /opt/rbenv/versions/1.9.3-p545/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- heroku-api (LoadError) from /opt/rbenv/versions/1.9.3-p545/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' from /usr/local/heroku/lib/heroku/client/organizations.rb:1:in `<top (required)>' from /opt/rbenv/versions/1.9.3-p545/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' from /opt/rbenv/versions/1.9.3-p545/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' from /usr/local/heroku/lib/heroku/command/base.rb:4:in `<top (required)>' from /opt/rbenv/versions/1.9.3-p545/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' from /opt/rbenv/versions/1.9.3-p545/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' from /usr/local/heroku/lib/heroku/command/auth.rb:1:in `<top (required)>' from /opt/rbenv/versions/1.9.3-p545/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' from /opt/rbenv/versions/1.9.3-p545/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' from /usr/local/heroku/lib/heroku/command.rb:14:in `block in load' from /usr/local/heroku/lib/heroku/command.rb:13:in `each' from /usr/local/heroku/lib/heroku/command.rb:13:in `load' from /usr/local/heroku/lib/heroku/cli.rb:27:in `start' from /usr/local/heroku/bin/heroku:24:in `<main>'
heroku-apiというのが足りないらしい。これまた調べてみるとgemで提供されているようなのでGemfileを作ってbundlerでインストールしておきます。
[vagrant@localhost ~]$ cat Gemfile source 'https://rubygems.org' gem "heroku-api", "0.3.18" [vagrant@localhost ~]$ bundle install Fetching gem metadata from https://rubygems.org/... Resolving dependencies... Installing excon (0.32.1) Using multi_json (1.9.2) Installing heroku-api (0.3.18) Using bundler (1.5.3) Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
で、確認。
[vagrant@localhost ~]$ heroku version heroku-toolbelt/3.6.0 (x86_64-linux) ruby/1.9.3
今度は無事に実行できるようになりました。