尝试从本地机器配置 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
.我找到了答案这里