19
Invalid gemspec in [/usr/lib/ruby/gems/1.8/specifications/activemodel-3.2.0.gemspec]: Illformed requirement ["#<YAML::Syck::DefaultKey:0xb5f9c990> 3.2.0"]

From trying to do a sudo gem update for other issues

getting this hundreds of time as sudo gem update goes through each gem and gets the message for most of them

Michael Durrant
  • 93,410
  • 97
  • 333
  • 497

3 Answers3

24

This can happen when upgrading to Rails 3.2.

Updating Rubygems should fix this issue.

gem update --system

Hope this helps.

Phil Bottomley
  • 2,387
  • 1
  • 17
  • 20
  • sort of. It fixed the immediate issue... and raised gem install linecache19 -v '0.5.11' Building native extensions. This could take a while... ERROR: Error installing linecache19: ERROR: Failed to build gem native extension. /home/durrantm/.rvm/rubies/ruby-1.8.7-p352/bin/ruby extconf.rb *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of – Michael Durrant Jan 25 '12 at 17:40
  • which I will post separately. – Michael Durrant Jan 25 '12 at 17:40
  • I had the same problem with dm-active_model-1.2.1 and rails 3.1. Updating rubygems fixed it :) Thanks! This was the error I got: `Invalid gemspec in [[project_dir]/shared/bundle/ruby/1.9.1/specifications/dm-active_model-1.2.1.gemspec]: Illformed requirement ["# 1.2.3"]` – mltsy Apr 12 '12 at 20:45
8

I still had the errors after updating the rubygem.

Then I ran rvm gemset empty to delete the gems. This fixed it for me.

Roshan
  • 905
  • 9
  • 21
Rainer Blessing
  • 1,131
  • 2
  • 11
  • 22
  • I had to use "rvmsudo rvm gemset empty" for my globally installed gems, but thanks for the empty tip ! – Martin T. Mar 21 '12 at 09:47
  • Where do you get the "rvm" or "rvmsudo" commands from? My system doesn't seem to have those. – Brian Knoblauch Aug 09 '12 at 15:44
  • 1
    rvm is a ruby version manager (https://rvm.io/). A utility to have several ruby version installed, with their own gems. Running this command won't help with this problem if you don't already have rvm installed. – Rainer Blessing Aug 09 '12 at 19:59
1

I had this issue, but all the methods above did not help.

So, I decided to move all the *3.2.0.spec within directory

/usr/local/ruby/lib/ruby/gems/1.9.1/specifications

into another directory, and things are solved.

Command:

sudo mv /usr/local/ruby/lib/ruby/gems/1.9.1/specifications/actionmailer-3.2.0.gemspec <another_dir>

Perform similar commands to other files:

  • actionpack-3.2.0.gemspec
  • activemodel-3.2.0.gemspec
  • activerecord-3.2.0.gemspec
  • activeresource-3.2.0.gemspec
  • activesupport-3.2.0.gemspec
  • newrelic_rpm-3.2.0.gemspec
  • rails-3.2.0.gemspec
  • railties-3.2.0.gemspec
robert
  • 33,242
  • 8
  • 53
  • 74
datnt
  • 372
  • 2
  • 15