Sklerozz
Sklerozz

Reputation: 137

Error installing nio4r

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!

Upvotes: 11

Views: 18352

Answers (4)

Allison
Allison

Reputation: 2333

The root cause of this error message for me was that Xcode updated and I had not accepted the new license agreement yet, so (for some reason) it restricted access to CLT (Command Line Tools -- this is what the xcode-select --install command installs).

If you already have CLT installed, you may need to run the following to get them to work:

sudo xcodebuild -license accept

This is what fixed my issue; I hope it helps someone else.

Upvotes: 3

Alfred Huang
Alfred Huang

Reputation: 176

I am on mac and I fixed it by typing the following code

xcode-select --install
gem install rails

Upvotes: 8

Ishank Gupta
Ishank Gupta

Reputation: 1593

Version 2.1.0 works with

sudo apt-get install libgmp3-dev

Upvotes: 0

Samuel Diez
Samuel Diez

Reputation: 541

At first try to install build essentials:

sudo apt-get install build-essential patch

and if still don't work try to install ruby-dev:

sudo apt-get install ruby-dev zlib1g-dev liblzma-dev

regards

Upvotes: 37

Related Questions