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

18,728

Solution 1

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'

Solution 2

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?

Solution 3

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.

Solution 4

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.

Solution 5

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.*>/=/.

Share:
18,728

Related videos on Youtube

AdamT
Author by

AdamT

Updated on June 04, 2022

Comments

  • AdamT
    AdamT almost 2 years

    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?

  • BF4
    BF4 over 12 years
    (our cucumber-rails version was also limited by our specified nokogiri version, fwiw)
  • BF4
    BF4 over 12 years
    (we're on rubygems 1.3.6. rvm install rubygems 1.3.6; also fixes ActiveSupport::Dependencies::Mutex error )
  • AdamT
    AdamT over 12 years
    Thanks for the idea but I've already done this. I'm running the latest version of bundler. I even created a new gemset using ruby 192p180 with rails 3.0.10 and got this error right away when i did a bundle install having declared 'cucumber-rails' in my gemfile.
  • AdamT
    AdamT over 12 years
    Will this remove all my gemsets in the current ruby implementation? Also, "rvm gemset clean" didn't work. Did you mean "rvm gemset clear"? Thanks
  • AdamT
    AdamT over 12 years
    This seems to have worked! Will need to test it out some more. However, will I be able to use the new version of cucumber with my current version of bundler at some point?
  • Romain Champourlier
    Romain Champourlier over 12 years
    I think it is rvm gemset empty.
  • argent_smith
    argent_smith over 12 years
    I'm just curious: did you run gem update --system ? I'm sure it's all gem(1) problem: they did some work on security issues.
  • Nic Aitch
    Nic Aitch over 12 years
    yep rvm gemset empty. It'll blow away your gemset, but this is good. Rerun bundle to install fresh.
  • Kyle Macey
    Kyle Macey about 11 years
    It's now rvm all do gem install bundler