LoginSignup
17
7

More than 5 years have passed since last update.

EC2へのデプロイ時のgemインストール「bundler:install」エラー対応

Last updated at Posted at 2018-04-12

自分がcapistranoでデプロイ時に出たgemインストールエラーを備忘録。

エラー内容

ローカルのターミナル
UsernoMacBook-Pro:test-APP user$ bundle exec cap production deploy # capistranoのデプロイコマンド
00:00 git:wrapper
       mkdir -p /tmp
    ✔  ec2-user@10.100.10.100 0.074s
      Uploading /tmp/git-ssh-test-APP-production-test.sh
・
・
・
00:07 bundler:install
       $HOME/.rbenv/bin/rbenv exec bundle install --path /var/www/test-APP/shared/bundle --without development test       Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

      current directory:
       /var/www/chat-space/shared/bundle/ruby/2.3.0/gems/ovirt-engine-sdk-4.2.3/ext/ovirtsdk4c
       /home/ec2-user/.rbenv/versions/2.3.1/bin/ruby -r
       ./siteconf20180411-1701-1tt6of5.rb extconf.rb
       checking for xml2-config... yes
       checking for curl-config... no
       *** extconf.rb failed ***
       Could not create Makefile due to some reason, probably lack of 
        --with-libcurl-config
        --without-libcurl-config
        --with-pkg-config
        --without-pkg-config
       extconf.rb:40:in `<main>': The "libcurl" package isn't available. (RuntimeError)

なんぞやコレは?
checking for curl-config... noとか、
extconf.rb:40:in `<main>': The "libcurl" package isn't available. (RuntimeError)
というエラーが出ている。

原因

調べてみたら、curlやlibcurlがインストールされてないらしい。
なので早速インストール

解決策

サーバに接続してるターミナル
$ sudo yum -y install curl
$ sudo yum -y install libcurl libcurl-devel

※自分の場合は「libcurl」がなかった。

インストール後、再度デプロイ

ローカルのターミナル
00:07 bundler:install
       $HOME/.rbenv/bin/rbenv exec bundle install --path /var/www/chat-space/shared/bundle --without development test    ✔  ec2-user@10.100.10.100 0.506s
00:08 deploy:assets:precompile
       $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile

お!通った!
EC2でデプロイしている時に「bundle:install」でエラーが出る場合は、サーバ上に何かインストールされるべきものがされてないみたい。
checking for curl-config... noextconf.rb:40:in `<main>': The "libcurl" package isn't available. (RuntimeError)というエラーメッセージに表示されているものをインストールしてみましょう。

curl、libcurl以外の場合は下記記事参照。
1.bundleでnative extensionを使ったgemのインストールでエラーになる件(mysql2,rmagick,sqlite3)
2.gem インストール時に発生したエラーとその解決方法まとめ(therubyracer,kakasi, mecab,libxml-ruby,nokogiri,capybara-webkit,thrift)
3.ruby-filemagic -v 0.6.1 Gem::Ext::BuildError: ERROR: Failed to build gem native extension. の解決方法

17
7
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
17
7