bundle install failed (ERROR: Error installing nokogiri: ERROR: Failed to build gem native extension)

356 views Asked by At

I'm a newbi to ruby I have trouble executing the command :

bundle install

I'm using FEDORA28 and have installed ruby with rvm but apparently something is missing or a permission is wrong but I don't get it. I have this answer :

Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Using rake 12.0.0
Using concurrent-ruby 1.0.5
Using i18n 0.8.6
Using minitest 5.10.3
Using thread_safe 0.3.6
Using tzinfo 1.2.3
Using activesupport 5.1.3
Using builder 3.2.3
Using erubi 1.6.1
Using mini_portile2 2.2.0
Fetching nokogiri 1.8.0
Installing nokogiri 1.8.0 with native extensions
Errno::EACCES: Permission denied @ rb_sysopen -
/home/BFournier/Documents/Boris/rothenberg/benchmark-headless-chrome- 
vs-phantomjs/vendor/bundle/ruby/2.5.0/extensions/x86_64- 
linux/2.5.0/nokogiri-1.8.0/gem_make.out
An error occurred while installing nokogiri (1.8.0), and Bundler 
cannot continue.
Make sure that `gem install nokogiri -v '1.8.0' --source 
'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  rails was resolved to 5.1.3, which depends on
    actioncable was resolved to 5.1.3, which depends on
      actionpack was resolved to 5.1.3, which depends on
        actionview was resolved to 5.1.3, which depends on
          rails-dom-testing was resolved to 2.0.3, which depends on
            nokogiri

and when I try to execute this :

gem install nokogiri -v '1.8.0' --source 'https://rubygems.org/'

I have this :

ERROR:  Error installing nokogiri:
ERROR: Failed to build gem native extension.

current directory: /home/BFournier/.gem/ruby/gems/nokogiri- 
1.8.0/ext/nokogiri
/usr/bin/ruby -r ./siteconf20181129-21800-1ke3w2r.rb extconf.rb
checking if the C compiler accepts ... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of 
necessary
libraries and/or headers.  Check the mkmf.log file for more details.  
You may need configuration options.

I found some similar questions but everything i'e tried didn't work at the moment. thanks in advance for any clues.

1

There are 1 answers

0
Boris Fournier On

Silly me that was so simple I hate myself. It was just that I've probably installed something with sudo and the permission was only for ROOT user so I've just changed the right of the file and that's it. Thanks again for your help @drosam