4
votes

I am experiencing an error with running the Rake command. When I try to Rake in my Rails project, I get an error that says Could not find rake-10.1.1 in any of the sources.

I put Rake 10.1.1 in my Gemfile, but it appears to do nothing when I bundle install.

I've tried uninstalling then installing the Rake gem in my computer's Ruby, RVM Ruby-2.1.0, the RVM Ruby-2.1.0@global, and the RVM gemset that I created for the specific project. I've also tried removing the Gemfile.lock and then bundle installing.

I've tried to manually run rake out of the terminal in multiple different Ruby/gems files including RVM. It gives this error:

/Users/me/.rvm/gems/ruby-2.1.0/gems/rake-10.1.1/bin/rake ; exit; ~ me$ /Users/me/.rvm/gems/ruby-2.1.0/gems/rake-10.1.1/bin/rake ; exit; rake aborted! No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)

I have a Rakefile in my project and have tried renaming it as well (Rakefile.rb, rakefile).

When I run Rake commands such as rake db:migrate, I get this error:

rake aborted! undefined local variable or method config' for main:Object /Users/me/RailsProject/config/environment.rb:4:in' /Users/me/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in require' /Users/me/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:inblock in require' /Users/me/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in load_dependency' /Users/me/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:inrequire' /Users/me/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/application.rb:189:in require_environment!' /Users/me/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/application.rb:250:inblock in run_tasks_blocks' /Users/me/.rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15:in eval' /Users/me/.rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15:in' Tasks: TOP => db:migrate => environment (See full trace by running task with --trace)

I've looked everywhere for the solution before coming here, but I could not find it. I would be appreciative if someone could give me some advice on this issue. Thank you in advance.

2
have you tried "bundle exec rake db:migrate"Noah Davis
I get the same long error that I listed in the second block.user3181113
Is there some kind of system-wide command I can use to uninstall all references of a gem? Or reset/update a gem over the entire system?user3181113

2 Answers

0
votes

Looks like it it having trouble finding dependencies. Have you installed rake on your system with gem install rake? If not you will need to use bundle exec rake.

0
votes

I don't know what the problem was, but I solved it by creating a new gemset, installing Rake to it, and using it. I also switched from Rubymine to Sublime. It may have been Rubymine trying to use a different gemset. Beware of those IDE settings.