"ffi"が"Failed to build gem native extension"と怒られる時の対処法

概要

capistranoでデプロイしているときに、
bundle installの時に、以下のエラーがでた

cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as ec2-user@54.95.189.234: bundle exit status: 5
bundle stdout: Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:

(中略...)

An error occurred while installing ffi (1.9.21), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.9.21'` succeeds before bundling.

In Gemfile:
  bootstrap-sass was resolved to 3.3.7, which depends on
    sass was resolved to 3.5.5, which depends on
      sass-listen was resolved to 4.0.0, which depends on
        rb-inotify was resolved to 0.9.10, which depends on
          ffi

結論

こちらを参考にしました。
https://github.com/ffi/ffi/issues/552

$ sudo yum install libffi-devel redhat-rpm-config

ec2上に足りていなかったらしい。

Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account log in.