33

Trying to run rake cucumber:ok and am getting this error:

/Users/dev/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rack-1.3.4/lib/rack/backports/uri/common_192.rb:53: warning: already initialized constant WFKV_

Then:
Command failed with status (1): [/Users/dev/.rbenv/versions/1.9.2-p290/bin...]

I am pretty new to Rails and Google didn't turn anything up for this error.

EDIT: I've tried adding bundle exec and that makes no difference.

Here's what I got with --trace:

/Users/dev/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/file_utils.rb:53:in `block in create_shell_runner'
/Users/dev/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/file_utils.rb:45:in `call'
/Users/dev/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/file_utils.rb:45:in `sh'
/Users/dev/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/file_utils_ext.rb:36:in `sh'
/Users/dev/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/cucumber-1.1.0/lib/cucumber/rake/task.rb:104:in `run'
/Users/dev/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/cucumber-1.1.0/lib/cucumber/rake/task.rb:193:in `block in define_task'
/Users/dev/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
/Users/dev/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:205:in `block in execute'
/Users/dev/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
/Users/dev/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
/Users/dev/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/dev/.rbenv/versions/1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/dev/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/dev/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
/Users/dev/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task'
/Users/dev/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in `block (2 levels) in top_level'
/Users/dev/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
/Users/dev/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in `block in top_level'
/Users/dev/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/dev/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
/Users/dev/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:62:in `block in run'
/Users/dev/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/dev/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/Users/dev/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/rake-0.9.2/bin/rake:32:in `<top (required)>'
/Users/dev/.rbenv/versions/1.9.2-p290/bin/rake:19:in `load'
/Users/dev/.rbenv/versions/1.9.2-p290/bin/rake:19:in `<main>'
Tasks: TOP => cucumber:ok
Emily
  • 17,813
  • 3
  • 43
  • 47
Brandon
  • 1,997
  • 3
  • 24
  • 33

4 Answers4

51

I started having the same problem this evening. It seems to be related to Rack 1.3.4. I fixed it by adding this to my Gemfile:

gem 'rack', '1.3.3'

Then running:

bundle update rack

Incidentally, I tried Bozhidar's suggestion before this, but to no avail.

Daniel Situnayake
  • 2,874
  • 2
  • 30
  • 38
  • 14
    From the comments in common_192.rb ("Stolen from ruby core's uri/common.rb @32618ba to fix DoS issues in 1.9.2" and "This should probably be removed once there is a Ruby 1.9.2 patch level that includes this fix.") it looks as if this was added to rack to prevent a denial-of-service attack. It purposely monkeypatches a vulnerability in Ruby but the monkeypatch results in the "already initialized constant" warning. So it looks like the choice is either to revert to 1.3.3 as suggested by Daniel or to get the fix and put up with the warning for awhile. – Brian Morearty Oct 02 '11 at 17:16
  • 1
    In my case, the warning was preventing asset pipeline precompilation, so reverting to 1.3.3 was the only option. – Daniel Situnayake Oct 03 '11 at 20:23
  • 4
    A fix for this has been added - https://github.com/rack/rack/commit/235f83cb88650beaa7fd0089ee0d19ca46507fc0 - so it should be in the next release of rack. If you really need rack 1.3.4 for some reason you could do something like `require 'uri/common'; ::URI.send :remove_const, :WFKV_` before you require rack. It'll even work in your Gemfile. – matt Oct 09 '11 at 20:34
  • 1
    Just a minor note: I would not do bundle update but instead `bundle update rack`. `bundle update` will want to update all gems. – yekta Oct 17 '11 at 18:15
8

Rack 1.3.5 is out now, which has fixed this warning.

Anders Kindberg
  • 865
  • 10
  • 7
0

you should uninstall rake-0.9.2 and install rack 1.6.13

gem uninstall rake
gem install  rack 1.6.13
-1

So, I included:

require 'uri/common'; ::URI.send :remove_const, :WFKV_

however the comment which says "it will work in the Gemfile" in fact should read "Must be in the Gemfile."

Daniel
  • 646
  • 7
  • 16