Prashant
Prashant

Reputation: 179

Error while installing the mimemagic in rails

I am using rails 4.2.4 and try to install paperclip gem in my application. After editing my gem file when I run bundle install.Then I got the error.

Bundler::GemspecError: Could not read gem at /home/darkpasenger/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/cache/mimemagic-0.3.0.gem. It may be corrupted.

An error occurred while installing mimemagic (0.3.0), and Bundler cannot continue.

Make sure that gem install mimemagic -v '0.3.0' succeeds before bundling.

So I run the command gem install mimemagic -v '0.3.0.Then again I got the error.

ERROR:  Error installing mimemagic:
invalid gem: package is corrupt, exception while verifying: undefined method `size' for nil:NilClass (NoMethodError) in /home/darkpasenger/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/cache/mimemagic-0.3.0.gem

Please help me out to fix this problem.

Upvotes: 13

Views: 15843

Answers (3)

Vipul
Vipul

Reputation: 941

These two commands fixed the issue for me.

  1. brew install shared-mime-info
  2. bundle install

But i need to run first this command sudo chown -R $(whoami) $(brew --prefix)/* because brew install shared-mime-info is failed in my system with the error permission denied @rb_file_s_symlink

Upvotes: 5

gadildafissh
gadildafissh

Reputation: 2402

I found the answer here: https://programmerah.com/mimemagic-0-3-10-install-error-and-bundler-cannot-continue-26830/

but I have pasted the steps in case the link stops working.

  1. brew install shared-mime-info
  2. bundle install

These two commands fixed the issue for me.

fissh

Upvotes: 42

bosskovic
bosskovic

Reputation: 2054

Try deleting this file from the system

/home/darkpasenger/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/cache/mimemagic-0.3.0.gem

and then try installing the gem again. It seems that the gem was not properly downloaded.

Upvotes: 1

Related Questions