ruby-on-railsrubycapistranonokogiridarwin

Rails 6 - Nokogiri LoadError conflict between development and production (x86_64-darwin & x86_64-linux)


When I try deploy using capistrano gem I get:

rake stderr: rake aborted!
LoadError: cannot load such file -- nokogiri/nokogiri

In my Gemfile.lock I can see that nokogiri is installed nokogiri (1.11.2-x86_64-darwin) which is for mac since I'm using mac for development, and when I do gem list in my production which is ubuntu I see nokogiri (1.11.2 x86_64-linux).

Based on one of the answers on SO, I removed -x86_64-darwin from nokogiri (1.11.2-x86_64-darwin) but this gave me:

Downloading nokogiri-1.11.2 revealed dependencies not in the API or the lockfile (mini_portile2 (~> 2.5.0)).
Either installing with `--full-index` or running `bundle update nokogiri` should fix the problem.

I ran bundle update nokogiri with no luck and it only said: Bundler attempted to update nokogiri but its version stayed the same.

I know this issue might happen since the nokogiri in my local is for mac and for development is for Linux.

I'm not sure what I can do to resolve this issue. Any feedback is appreciated.

Rails: 6.1.3
Ruby: 2.5.8

Solution

  • I've faced a similar problem and this helped me.