我在CentOS 7.2上安装rail,这是我的安装命令:

gem install rails -v=4.2

这是错误日志输出:
[root@localhost ~]# gem install rails -v=4.2
gem install rails -v=4.2Building native extensions.  This could take a while...
ERROR:  Error installing rails:
        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 /usr/local/share/gems/gems/nokogiri-1.6.8.1 for inspection.
Results logged to /usr/local/share/gems/gems/nokogiri-1.6.8.1/ext/nokogiri/gem_make.out

中心:7.2
Ruby:Ruby 2.0.0p598(2014-11-13)[x86_64-linux]
宝石:2.0.14

最佳答案

只需使用以下命令更新系统

gem update --system 2.0.3

关于ruby-on-rails - 安装Rails错误:无法构建gem native 扩展,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/40627051/

10-16 22:40