"Invalid gemspec in" and "Illformed requirement" whenever I create a new project in rails (cucumber issue)

AdamT picture AdamT · Sep 11, 2011 · Viewed 18k times · Source

Every time I create a new project I get the following errors:

Adams-MacBook-Pro:for_testing adam$ rails new outsidein
Invalid gemspec in [/Users/adam/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/specifications/cucumber-1.0.4.gemspec]: Illformed requirement ["# 0.8.4"]

Invalid gemspec in [/Users/adam/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/specifications/cucumber-1.0.4.gemspec]: Illformed requirement ["# 0.8.4"]
Invalid gemspec in [/Users/adam/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/specifications/cucumber-1.0.4.gemspec]: Illformed requirement ["# 0.8.4"]

I've updated cucumber and cucumber-rails but I get the errors all over the place. What do I do?

Answer

mattwynne picture mattwynne · Sep 12, 2011

You need to update to the latest version of Rubygems, but you may also need to remove any gems installed on the older version of Rubygems.

If you're using rvm with gemsets, this is quite easy:

$ rvm gemset empty

Now you can update Rubygems:

$ gem update --system

If you've lost bundler because it was installed in your gemset, install it in the global gemset so it's there for all your gemsets, for good:

$ rvm @global gem install bundler

Now you can reinstall all your gems in a nice clean gemset on the shiny new Rubygems:

$ bundle

Happy now?