17
votes

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?

6
Can you post the output from "gem list" and "which rails" please.Andy Waite
@andywaite gem list: Invalid gemspec in [/Users/adamtal/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/specifications/cucumber-1.0.4.gemspec]: Illformed requirement ["#<Syck::DefaultKey:0x00000102452b28> 0.8.4"] *** LOCAL GEMS *** Invalid gemspec in [/Users/adamtal/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/specifications/cucumber-1.0.4.gemspec]: Illformed requirement ["#<Syck::DefaultKey:0x00000102452b28> 0.8.4"] abstract (1.0.0) ... lots of gems!!! ... ZenTest (4.5.0) which rails /Users/adamtal/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/bin/railsAdamT
Not spacing correctly. Sorry about the appearance.AdamT
Can you post a link to the full output on pastie.org, it would probably be useful to see all the Gems you have. Also, please include the contents of your Gemfile and Gemfile.lock.Andy Waite
blog.rubygems.org/2011/08/31/shaving-the-yaml-yacc.html suggests that upgrading Rubygems may fix the issue.Andy Waite

6 Answers

63
votes

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?

9
votes

This issue is best described on RubyGems blog:

http://blog.rubygems.org/2011/08/31/shaving-the-yaml-yak.html

TL;DR: gem update --system and gem update bundler

RubyGems 1.8.10 solves this.

4
votes

See what helped me out:

$ gem update --system
...
$ bundle update

Notes:

  1. I use Ruby 1.8.7-352.
  2. Cucumber is visible to the Bundler via Gemfile so I can manage its version from there.

I think the key is updating rubygems.

4
votes

I had a lot of this kind of errors too. I just manually edited .gemspec files and changed #<Syck::DefaultKey-blah-blah to =. For vim the search and replace command is %s/#<Syck::DefaultKey:0x.*>/=/.

1
votes

Cucumber-rails 0.3.2 required cucumber > 0.8.0, but when bundler changed us from 0.10.2 to 1.04 it broke. Require an older cucumber like 0.10.2 and it will work

gem 'cucumber-rails', '0.3.2' gem 'cucumber', '0.10.2'

1
votes

I just pinned cucumber to 1.0.2, helps for the moment...

  gem 'cucumber', "1.0.2"
  gem 'cucumber-rails', "1.0.2"