我使用的是Fedora 20,安裝了Ruby 2.0和Rails 4.1.6。Fedora 20上的Ruby on Rails
我試圖rails new example
但得到這個錯誤:
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies...
Using rake 10.3.2
Using i18n 0.6.11
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/sntr/.gem/ruby/gems/json-1.8.1 for inspection.
Results logged to /home/sntr/.gem/ruby/gems/json-1.8.1/ext/json/ext/generator/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.
run bundle exec spring binstub --all
bundler: command not found: spring
Install missing gem executables with `bundle install`
我試圖gem install json -v '1.8.1'
或sudo yum install json
...但它並沒有改變,我無法運行Rails。
看起來像ruby頭文件丟失。嘗試通過YUM首先安裝它們:'sudo yum install ruby-devel'接下來,您可能會遇到一些其他需要的devel軟件包,例如'libxml2-devel'和數據庫'sqlite3-devel'(和'mysql-devel'如果你打算使用MySQL) – 2014-10-30 18:52:32
這是RHEL的一個可比較的問題http://stackoverflow.com/questions/18918588/did-i-install-ruby-1-9-3-correctly-on-rhel雖然,你贏了' t想要'ruby193-devel'軟件包,而在Fedora上使用簡單的'ruby-devel',它提供了Ruby 2.0 – 2014-10-30 19:08:09