Help me, please. I'm try to install gem nio4r, but have error with this logs:
ERROR: Error installing nio4r:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.3.0/gems/nio4r-1.2.1/ext/nio4r
/usr/bin/ruby2.3 -r ./siteconf20161020-13985-1c6zxok.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/nio4r-1.2.1 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/nio4r-1.2.1/gem_make.out
I have ubuntu 16.04, ruby 2.3.0, rails 5.0.0.1.
(with some other gems I have similar error (gem bcrypt))
What I must did to fix this bug? Thank's!
答案 0 :(得分:28)
首先尝试安装build essentials:
sudo apt-get install build-essential patch
如果仍然无法尝试安装ruby-dev:
sudo apt-get install ruby-dev zlib1g-dev liblzma-dev
问候
答案 1 :(得分:1)
我在Mac上,我通过输入以下代码修复它
xcode-select --install
gem install rails
答案 2 :(得分:1)
对我来说,此错误消息的根本原因是Xcode已更新并且我尚未接受新的许可协议,因此(出于某种原因)它限制了对CLT的访问(命令行工具-这就是{{ 1}}命令安装)。
如果已经安装了CLT,则可能需要运行以下命令才能使它们工作:
xcode-select --install
这就是解决我的问题的原因;我希望它可以帮助其他人。
答案 3 :(得分:0)
版本2.1.0适用于
sudo apt-get install libgmp3-dev