2013-04-09 38 views
0

我正嘗試通過在線教程學習Ruby on Rails。Rails沒有正確創建新的應用程序 - 與JSON 1.7.7衝突?

[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爲上市,但是結果是:

[[email protected] 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 

有沒有人看到了嗎?

+0

將結果中記錄的日誌記錄到/home/philippe/.gem/ruby/1.9.1/gems/json-1.7.7/ext/json/ext/generator/gem_make.out成爲要點 – rovermicrover 2013-04-09 01:06:25

+0

檢查此鏈接http://stackoverflow.com/questions/11058952/why-do-i-get-an-error-installing-the-json-gem-in-ubuntu – Shrikant1712 2013-04-09 05:27:04

回答

1

如果你是在一個 「轉」 系統(FedoraRed Hat)使用方法:

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

它解決了這個問題對我來說。

相關問題