Ruby not installing json -v 1.8.1 as part of bundle, ERROR: Failed to build gem native extension

你离开我真会死。 提交于 2019-12-12 04:45:14

问题


I've tried installing using as part of the bundle and using sudo, but I get the same error message every time. I'm currently on Ruby 2.0.0 and Rails 4.1.8. I'm not sure what is going on. The exact error message below:

Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies...
Using rake 10.4.2 Using i18n 0.6.11

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20141218-80226-brqexc.rb extconf.rb mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/json-1.8.1 for inspection. Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-14/2.0.0/json-1.8.1/gem_make.out An error occurred while installing json (1.8.1), and Bundler cannot continue. Make sure that gem install json -v '1.8.1' succeeds before bundling.

Any advice appreciated.


回答1:


I've run into similar error on Ubuntu and all I needed to do was:

sudo apt-get install ruby-dev

For Mac, the following gist seems worth to have a look into: Setup mac for ruby dev



来源:https://stackoverflow.com/questions/27553261/ruby-not-installing-json-v-1-8-1-as-part-of-bundle-error-failed-to-build-gem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!