0

Possible Duplicate:
Ruby on Rails and Rake problems: uninitialized constant Rake::DSL

I'm in the early stages of learning Rails. I'm following the tutorial in the Agile WebDev book. When I tried to apply my first migration, I got the following error:

rake aborted!
uninitialized constant Rake::DSL
D:/Learning/Ruby On Rails/Ruby/Ruby192/lib/ruby/1.9.1/rake.rb:2482:in `const_missing'
D:/Learning/Ruby On Rails/Ruby/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/tasklib.rb:8:in `<class:TaskLib>'
D:/Learning/Ruby On Rails/Ruby/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/tasklib.rb:6:in `<module:Rake>'
D:/Learning/Ruby On Rails/Ruby/Ruby192/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/tasklib.rb:3:in `<top (required)>'
D:/Learning/Ruby On Rails/Ruby/Ruby192/lib/ruby/gems/1.9.1/gems/rdoc-3.9.4/lib/rdoc/task.rb:37:in `require'
D:/Learning/Ruby On Rails/Ruby/Ruby192/lib/ruby/gems/1.9.1/gems/rdoc-3.9.4/lib/rdoc/task.rb:37:in `<top (required)>'
D:/Learning/Ruby On Rails/Ruby/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.10/lib/rails/tasks/documentation.rake:2:in `require'
D:/Learning/Ruby On Rails/Ruby/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.10/lib/rails/tasks/documentation.rake:2:in `<top (required)>'
D:/Learning/Ruby On Rails/Ruby/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.10/lib/rails/tasks.rb:15:in `load'
D:/Learning/Ruby On Rails/Ruby/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.10/lib/rails/tasks.rb:15:in `block in <top (required)>'
D:/Learning/Ruby On Rails/Ruby/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.10/lib/rails/tasks.rb:6:in `each'
D:/Learning/Ruby On Rails/Ruby/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.10/lib/rails/tasks.rb:6:in `<top (required)>'
D:/Learning/Ruby On Rails/Ruby/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.10/lib/rails/application.rb:215:in `require'
D:/Learning/Ruby On Rails/Ruby/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.10/lib/rails/application.rb:215:in `initialize_tasks'
D:/Learning/Ruby On Rails/Ruby/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.10/lib/rails/application.rb:139:in `load_tasks'
D:/Learning/Ruby On Rails/Ruby/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.10/lib/rails/application.rb:77:in `method_missing'
C:/Documents and Settings/Wael Khobalatte/Bureau/sellit/Rakefile:7:in `<top (required)>'
D:/Learning/Ruby On Rails/Ruby/Ruby192/lib/ruby/1.9.1/rake.rb:2373:in `load'
D:/Learning/Ruby On Rails/Ruby/Ruby192/lib/ruby/1.9.1/rake.rb:2373:in `raw_load_rakefile'
D:/Learning/Ruby On Rails/Ruby/Ruby192/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile'
D:/Learning/Ruby On Rails/Ruby/Ruby192/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
D:/Learning/Ruby On Rails/Ruby/Ruby192/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile'
D:/Learning/Ruby On Rails/Ruby/Ruby192/lib/ruby/1.9.1/rake.rb:1991:in `run'
D:/Learning/Ruby On Rails/Ruby/Ruby192/bin/rake:31:in `<main>'

I have tried different solutions available here and elsewhere and none worked. I updated rake, evoked the bundle, and even added a require 'rake/dsl_definition' to the Rakefile. I even created an app elsewhere to see if the location was the problem (I was developing inside my Dropbox), but it persisted.

Here is the Gemfile:

    source 'http://rubygems.org'

gem 'rails', '3.0.10'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3'

# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
# gem 'ruby-debug'
# gem 'ruby-debug19', :require => 'ruby-debug'

# Bundle the extra gems:
# gem 'bj'
# gem 'nokogiri'
# gem 'sqlite3-ruby', :require => 'sqlite3'
# gem 'aws-s3', :require => 'aws/s3'

# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
# group :development, :test do
#   gem 'webrat'
# end

And here is the output when I run rake test:

D:/Learning/Ruby On Rails/Ruby/Ruby192/bin/ruby.exe: invalid option -O  (-h will show valid options) (RuntimeError)
D:/Learning/Ruby On Rails/Ruby/Ruby192/bin/ruby.exe: invalid option -O  (-h will show valid options) (RuntimeError)
D:/Learning/Ruby On Rails/Ruby/Ruby192/bin/ruby.exe: invalid option -O  (-h will show valid options) (RuntimeError)
Errors running test:units, test:functionals, test:integration!
Community
  • 1
  • 1
n_x_l
  • 1,552
  • 3
  • 17
  • 34
  • if you have `gem "rake"` in your Gemfile, either remove it, or change it to `gem "rake", :require => false` – Marian Theisen Sep 30 '11 at 19:41
  • @MarianTheisen: I don't have that on my Gemfile – n_x_l Sep 30 '11 at 22:09
  • @wael http://stackoverflow.com/questions/6085610/ruby-on-rails-and-rake-problems-uninitialized-constant-rakedsl – Mohit Jain Sep 30 '11 at 22:20
  • @MohitJain: Thanks. I downgraded rake and it worked. One question though, can the migration take 0.0000s? That's what it outputs now. And when I run rake test, it fails to recognize test as a rake option. – n_x_l Sep 30 '11 at 22:52
  • @MohitJain: Posted. While you take a look at it, I will try and reinstall everything. – n_x_l Oct 01 '11 at 18:51
  • @Wael Are you running windows? If yes then I am really sorry cause I have seen some of my collegues fighting with the same kind of issues. And i don't know how they fixed that. I am sure somebody else will surely help you. About migration taking 00 seconds. I think thats not possible it should take some fraction of time. Try bundle exec rake test I have seen some people using that to run some rake commands. I will suggest you to move on ubuntu or mac for rails development. OS think is my personal opinion. Please don't debate on that. You need some guidance or something make a comment. – Mohit Jain Oct 01 '11 at 20:38

0 Answers0