This is a note about when bundle install โforce in Rails caused nokogiri errors.
Error:
Errno::EACCES: Permission denied
An error occurred while installing nokogiri
Error and Question
When I tried to reinstall all gems,
bundle install --force
As soon as I did this, bundle install started throwing errors.
PS C:\pg\rails\tool> bundle install
Fetching gem metadata from https://rubygems.org/..........
Using rake 12.3.1
Using concurrent-ruby 1.0.5
Using i18n 1.0.1
Using minitest 5.11.3
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using activesupport 5.2.0
Using builder 3.2.3
Using erubi 1.7.1
Using mini_portile2 2.3.0
Fetching nokogiri 1.8.4 (x64-mingw32)
Installing nokogiri 1.8.4 (x64-mingw32)
Errno::EACCES: Permission denied @ rb_sysopen -
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/nokogiri-1.8.4-x64-mingw32/lib/nokogiri/2.4/nokogiri.so
An error occurred while installing nokogiri (1.8.4), and Bundler
cannot continue.
Make sure that `gem install nokogiri -v '1.8.4' --source
'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
rails was resolved to 5.2.0, which depends on
actioncable was resolved to 5.2.0, which depends on
actionpack was resolved to 5.2.0, which depends on
actionview was resolved to 5.2.0, which depends on
rails-dom-testing was resolved to 2.0.3, which depends on
I also tried this command, but the result was the same.
PS C:\pg\rails\tool> bundle config build.nokogiri --use-system-libraries
Is there a solution?
Resolved
I stopped rails s, waited for several tens of minutes, and tried the same command again, and it worked. I wonder why.
PS C:\pg\rails\tool> bundle install
Fetching gem metadata from https://rubygems.org/..........
Using rake 12.3.1
Using concurrent-ruby 1.0.5
Using i18n 1.0.1
Using minitest 5.11.3
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using activesupport 5.2.0
Using builder 3.2.3
Using erubi 1.7.1
Using mini_portile2 2.3.0
Fetching nokogiri 1.8.4 (x64-mingw32)
Installing nokogiri 1.8.4 (x64-mingw32)
Using rails-dom-testing 2.0.3
Using crass 1.0.4
Using loofah 2.2.2
Using rails-html-sanitizer 1.0.4
Using actionview 5.2.0
Using rack 2.0.5
Using rack-test 1.0.0
Using actionpack 5.2.0
Using nio4r 2.3.1
Using websocket-extensions 0.1.3
Using websocket-driver 0.7.0
Using actioncable 5.2.0
Using globalid 0.4.1
Using activejob 5.2.0
Using mini_mime 1.0.0
Using mail 2.7.0
Using actionmailer 5.2.0
Using activemodel 5.2.0
Using arel 9.0.0
Using activerecord 5.2.0
Using mimemagic 0.3.2
Using marcel 0.3.2
Using activestorage 5.2.0
Using public_suffix 3.0.2
Using addressable 2.5.2
Using io-like 0.3.0
Using archive-zip 0.11.0
Using bindex 0.5.0
Using msgpack 1.2.4 (x64-mingw32)
Using bootsnap 1.3.0
Using bundler 1.16.2
Using byebug 10.0.2
Using xpath 3.1.0
Using capybara 3.3.1
Using ffi 1.9.25 (x64-mingw32)
Using childprocess 0.9.0
Using chromedriver-helper 1.2.0
Using coffee-script-source 1.12.2
Using execjs 2.7.0
Using coffee-script 2.4.1
Using method_source 0.9.0
Using thor 0.20.0
Using railties 5.2.0
Using coffee-rails 4.2.2
Using duktape 2.0.1.0
Using multi_json 1.13.1
Using jbuilder 2.7.0
Using puma 3.11.4
Using sprockets 3.7.2
Using sprockets-rails 3.2.1
Using rails 5.2.0
Using rb-fsevent 0.10.3
Using rb-inotify 0.9.10
Using rubyzip 1.2.1
Using sass-listen 4.0.0
Using sass 3.5.6
Using tilt 2.0.8
Using sass-rails 5.0.7
Using selenium-webdriver 3.13.0
Using sqlite3 1.3.13 (x64-mingw32)
Using turbolinks-source 5.1.0
Using turbolinks 5.1.1
Using tzinfo-data 1.2018.5
Using uglifier 4.1.14
Using web-console 3.6.2
Bundle complete! 16 Gemfile dependencies, 76 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
Post-install message from nokogiri:
Nokogiri is built with the packaged libraries: libxml2-2.9.8, libxslt-1.1.32, zlib-1.2.11, libiconv-1.15.