以下是我输入的代码然后出现错误:我正在查找rails标头并查看可能发生的情况。我在这篇文章中发表了https://gorails.com/setup/ubuntu/16.04
和本文:http://ryanbigg.com/2014/10/ubuntu-ruby-ruby-install-chruby-and-you
什么也没有。gem install rails
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /var/lib/gems/2.3.0 directory.
rickus@rickus:~$ sudo gem install rails
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/nokogiri-1.8.1/ext/nokogiri
/usr/bin/ruby2.3 -r ./siteconf20170928-18941-1fdewid.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.3.0/gems/nokogiri-1.8.1 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/nokogiri-1.8.1/gem_make.out
答案 0 :(得分:0)
我也提出了这个问题,我使用sudo命令安装了ruby环境管理器rvm / rbenv。你可以重新安装你的ruby环境管理器并避免使用sudo命令,否则你所有的gem安装都需要你应该避免的sudo命令防止将来发生冲突。