ERROR: While executing gem … (TypeError) incompatible marshal file format (can't be read)

  • A+
Category:Languages

I encounter this issue with ruby version 2.4.4, OSX Mojave when I run bundle install :

Fetching nokogiri 1.8.5 Installing nokogiri 1.8.5 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. ERROR: cannot discover where libxml2 is located on your system. please make sure `pkg-config` is installed. 

So I ran

xcode-select --install 

But then when I run gem install nokogiri I got the following output:

ERROR:  While executing gem ... (TypeError) incompatible marshal file format (can't be read) format version 4.8 required; 60.33 given 

I tried to set my cookies_serializer to:

Rails.application.config.action_dispatch.cookies_serializer = :hybrid 

But nothing worked

Is there a way to fix this ? I cannot even run my rails server right now.

 


Try removing your ~/.gemrc. I had the same problem on Mojave and this solve my problem.

Comment

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: