0

我正在尝试通过在线教程学习 Ruby on Rails。

[rails version]: Rails 3.2.13
[ruby version] : ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-linux]

当我执行命令时:

rails new first_app

我得到:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /usr/bin/ruby extconf.rb 
mkmf.rb can't find header files for ruby at /usr/share/include/ruby.h


Gem files will remain installed in /home/philippe/.gem/ruby/1.9.1/gems/json-1.7.7 for inspection.
Results logged to /home/philippe/.gem/ruby/1.9.1/gems/json-1.7.7/ext/json/ext/generator/gem_make.out
An error occurred while installing json (1.7.7), and Bundler cannot continue.
Make sure that `gem install json -v '1.7.7'` succeeds before bundling.

果然,我gem install json -v '1.7.7按照列出的方式运行,但结果是:

[philippe@localhost rails_projects]$ gem install json -v '1.7.7'
Building native extensions.  This could take a while...

ERROR:  Error installing json:
  ERROR: Failed to build gem native extension.

        /usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /usr/share/include/ruby.h


Gem files will remain installed in /home/philippe/.gem/ruby/1.9.1/gems/json-1.7.7 for inspection.
Results logged to /home/philippe/.gem/ruby/1.9.1/gems/json-1.7.7/ext/json/ext/generator/gem_make.out

有人见过吗?

4

1 回答 1

1

如果您在“rpm”系统(FedoraRed Hat)中,请使用:

sudo yum install -y gcc ruby-devel libxml2 libxml2-devel libxslt libxslt-devel

它为我解决了这个问题。

于 2013-04-09T01:06:57.287 回答