Michael
Michael

Reputation: 644

Rake error Rake::DSL

When I try doing rake db:migrate I get this error

rake aborted! uninitialized constant Rake::DSL
/home/laptop/RubymineProjects/website2/Rakefile:10

What do I have to do to fix this? I tried with multiple different rake versions. I'm running Rails 3.0.9, Ruby 1.8.7 and Ubuntu 11.04.

Upvotes: 0

Views: 996

Answers (2)

Lluís
Lluís

Reputation: 1317

on Debian Squeeze this is what I do to fix that:

Configure squeeze-backports and upgrade rubygems

apt-get install -t squeeze-backports rubygems

remove rake and it's executable

gem uninstall rake
rm /usr/bin/rake

install rake again, now the executable file will be /usr/local/bin/rake and error is gone

gem install rake

Upvotes: 0

dLobatog
dLobatog

Reputation: 1741

Include this in your Rakefile

require 'rake/dsl_definition'

Then bundle install and you're (hopefully) good to go :)


If this didn't work, try the following:

You're probably using Rake 0.87 so gem install rake -v=0.9.2 is something you should do.

Then remove old rake with gem uninstall rake -v=0.9.1

Then bundle update

And if you still have any problem then...

Add the following to your Rake file

module ::YourApplicationName  
  class Application
    include Rake::DSL
  end
end

Comment below if you are having any problem after all this little hacks...

Upvotes: 6

Related Questions