安装捆绑包时发生错误

安装捆绑包时发生错误

尝试从本地机器配置 githubpage 时发生以下错误:

显示错误:

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


运行命令 gem install ffi -v '1..9.14' 出现以下错误。

sudo  gem install ffi -v '1.9.14'
Building native extensions.  This could take a while...
ERROR:  Error installing ffi:
    ERROR: Failed to build gem native extension.

    current directory: /var/lib/gems/2.3.0/gems/ffi-1.9.14/ext/ffi_c
/usr/bin/ruby2.3 -r ./siteconf20160930-6846-1an2in3.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.3.0/gems/ffi-1.9.14 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86-linux/2.3.0/ffi-1.9.14/gem_make.out

然后我查看了日志文件:gem_make.out,其中显示以下错误

sudo cat /var/lib/gems/2.3.0/extensions/x86-linux/2.3.0/ffi-    1.9.14/gem_make.out
current directory: /var/lib/gems/2.3.0/gems/ffi-1.9.14/ext/ffi_c
/usr/bin/ruby2.3 -r ./siteconf20160930-6846-1an2in3.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

请建议我下载 ruby​​.h 并将其添加到特定位置的方法,或者帮助我以正确的方式安装 gem。

答案1

我也遇到过类似的问题。

安装 ffi(1.9.14)时发生错误,Bundler 无法继续。

gem install ffi -v '1.9.14'捆绑之前请确保成功。

我修复了它sudo apt-get install ruby-dev.我找到了答案这里

答案2

安装ruby-dev并没有解决这个问题。这似乎是一个已知问题,请参阅这里

那里给出的修复方法(对我有用)是:

sudo apt install libffi-dev

相关内容