Error installing nio4r

Help me please. I am trying to install gem nio4r but have an error with these 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 stones I have a similar error (gem bcrypt))

What should I do to fix this error? Thank's!

+6
source share
4 answers

First try installing the basics of the assembly:

sudo apt-get install build-essential patch

and if still not working, try installing ruby-dev:

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

considers

+27
source

I am on a mac and I fixed it by entering the following code

xcode-select --install
gem install rails
+1
source

2.1.0

sudo apt-get install libgmp3-dev

0

The main reason for this error message for me was that Xcode was updated, and I have not yet accepted the new license agreement, so (for some reason) it restricted access to the CLT (Command-line tools are what the command installs xcode-select --install).

If you already have CLT installed, you may need to do the following to get them working:

sudo xcodebuild -license accept

This is what fixed my problem; I hope this helps someone else.

0
source

Source: https://habr.com/ru/post/1658323/


All Articles