I created a new model, but when I run the rake db: migrate command, it shoots me the following error:
rake aborted!
Gem::LoadError: You have already activated rake 10.4.0, but your Gemfile requires rake
10.3.2. Prepending `bundle exec` to your command may solve this.
/Users/yedidyaweiner/projects/music-app/config/boot.rb:4:in `<top (required)>'
/Users/yedidyaweiner/projects/music-app/config/application.rb:1:in `<top (required)>'
/Users/yedidyaweiner/projects/music-app/Rakefile:4:in `<top (required)>'
LoadError: cannot load such file -- bundler/setup
/Users/yedidyaweiner/projects/music-app/config/boot.rb:4:in `<top (required)>'
/Users/yedidyaweiner/projects/music-app/config/application.rb:1:in `<top (required)>'
/Users/yedidyaweiner/projects/music-app/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
What am I doing wrong?
use
bundle exec rake db:migrate
You can also update your gems by running
bundle update
Execute the below commands
a) delete your Gemfile.lock file
b)bundle install
It should update Gemfile.lock with correct rake.
OR
a) gem uninstall rake -v 10.4.0
b) gem install rake -v 10.3.2
then try running 'rake db:migrate'. it should work.
Related
When I try to apply migrations through rake db:migrate, I get the following error:
rake aborted!
Gem::LoadError: You have already activated rake 12.0.0, but your
Gemfile requires rake 10.4.2. Prepending `bundle exec` to your command
may solve this.
/home/jeyjeyanischixx/CaprisePro/config/boot.rb:3:in `<top (required)>'
/home/jeyjeyanischixx/CaprisePro/config/application.rb:1:in `<top (required)>'
/home/jeyjeyanischixx/CaprisePro/Rakefile:4:in `<top (required)>'
/home/jeyjeyanischixx/.rvm/gems/ruby-2.4.1#global/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
Then when I add bundle exec before this command, I get this:
Could not find nokogiri-1.8.2 in any of the sources
Run `bundle install` to install missing gems.
But I have already installed all the gems successfully (including nokogiri and rake in two versions(10.4.2 and 12.0.0)).
Rails: 4.2.10;
Ruby: 2.4.1
well i try to install gem 'omniauth-twitter', create controllers and model this way
rails g controller sessions
rails g model userGem provider:string uid:string name:string
but, in the next step when i try to do a rake db:migrate, throw this error:
rake aborted!
Gem::LoadError: You have already activated rake 10.3.2, but your Gemfile requires rake 10.2.1. Prepending `bundle exec` to your command may solve this.
/home/salinas/.rvm/gems/ruby-2.1.1#global/gems/bundler-1.5.3/lib/bundler/runtime.rb:34:in ` block in setup'
/home/salinas/.rvm/gems/ruby-2.1.1#global/gems/bundler-1.5.3/lib/bundler/runtime.rb:19:in ` setup'
/home/salinas/.rvm/gems/ruby-2.1.1#global/gems/bundler-1.5.3/lib/bundler.rb:119:in `setup'
/home/salinas/.rvm/gems/ruby-2.1.1#global/gems/bundler-1.5.3/lib/bundler/setup.rb:7:in ` <top (required)>'
/home/salinas/blog/config/boot.rb:4:in `<top (required)>'
/home/salinas/blog/config/application.rb:1:in `<top (required)>'
/home/salinas/blog/Rakefile:4:in `<top (required)>'
LoadError: cannot load such file -- bundler/setup
/home/salinas/blog/config/boot.rb:4:in `<top (required)>'
/home/salinas/blog/config/application.rb:1:in `<top (required)>'
/home/salinas/blog/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
Any idea how to fix it?
Run the command as:-
bundle exec rake db:migrate
Or remove the rake 10.3.2 as:-
gem uninstall rake
Select the rake-10.3.2 to uninstall.
After removing rake 10.3.2, no need to append bundle exec.
~/Rails Projects/QA-app$ rake db:drop
rake aborted!
Gem::LoadError: You have already activated rake 10.3.2, but your Gemfile requires rake 10.1.1. Using bundle exec may solve this.
/home/salmanalam/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:33:in `block in setup'
/home/salmanalam/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.3.5/lib/bundler/runtime.rb:19:in `setup'
/home/salmanalam/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.3.5/lib/bundler.rb:120:in `setup'
/home/salmanalam/.rvm/gems/ruby-2.0.0-p353#global/gems/bundler-1.3.5/lib/bundler/setup.rb:7:in `<top (required)>'
/home/salmanalam/Rails Projects/QA-app/config/boot.rb:4:in `<top (required)>'
/home/salmanalam/Rails Projects/QA-app/config/application.rb:1:in `<top (required)>'
/home/salmanalam/Rails Projects/QA-app/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
Run the command using bundle exec(bundle exec rake db:drop) to force the version of rake that is used by your application.
Just run `bundle update and update your app. The version of Rake that it is looking for is 10.1.1 but your version of Rake has already been updated to 10.3.2
You can't just go updating all gems willy nilly on a larger project without running into problems. If you don't want to have to prefix bundle exec, then just run bundle update rake.
This is what worked for me:
rm -rf Gemfile.lock
Then run bundle install if needed, and rake db:(whatever) goes without error.
I started getting this error and would like a way to fix it:
You have already activated rake 10.1.1, but your Gemfile requires rake 10.1.0. Using bundle exec may solve this.
I am running this from within RubyMine. I can see in my Gemfile.lock where it specifies 10.1.0. Can I just manually update my Gemfile.lock to 10.1.1?
If I do:
$gem list
....
rake (10.1.1, 10.1.0, 10.0.4, 0.9.2.2)
So I'm not sure why it isn't just working with 10.1.0?
Here's the full output from RubyMine:
/Users/jt/.rvm/rubies/ruby-1.9.3-p448/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/jt/.rvm/gems/ruby-1.9.3-p448/bin/rake spec
Testing started at 3:15 PM ...
rake aborted!
You have already activated rake 10.1.1, but your Gemfile requires rake 10.1.0. Using bundle exec may solve this.
/Users/jt/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler/runtime.rb:33:in `block in setup'
/Users/jt/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler/runtime.rb:19:in `setup'
/Users/jt/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler.rb:120:in `setup'
/Users/jt/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler/setup.rb:17:in `<top (required)>'
/Users/jt/repos/app/config/boot.rb:6:in `<top (required)>'
/Users/jt/repos/app/config/application.rb:1:in `<top (required)>'
/Users/jt/repos/app/Rakefile:5:in `<top (required)>'
-e:1:in `load'
-e:1:in `<main>'
(See full trace by running task with --trace)
Process finished with exit code 1
You can remove your
Gemfile.lock file
and exec
bundle update
When executing any rake operation, I get the following:
rake aborted!
You have already activated rake 10.1.0, but your Gemfile requires rake 10.0.3. Using bundle exec may solve this.
/home/cristi/.rvm/gems/ruby-1.9.3-p392/gems/bundler-1.3.3/lib/bundler/runtime.rb:33:in `block in setup'
/home/cristi/.rvm/gems/ruby-1.9.3-p392/gems/bundler-1.3.3/lib/bundler/runtime.rb:19:in `setup'
/home/cristi/.rvm/gems/ruby-1.9.3-p392/gems/bundler-1.3.3/lib/bundler.rb:120:in `setup'
/home/cristi/.rvm/gems/ruby-1.9.3-p392/gems/bundler-1.3.3/lib/bundler/setup.rb:7:in `<top (required)>'
/home/cristi/code/kodion/config/boot.rb:6:in `<top (required)>'
/home/cristi/code/kodion/config/application.rb:1:in `<top (required)>'
/home/cristi/code/kodion/Rakefile:5:in `<top (required)>'
(See full trace by running task with --trace)
I am not sure what I can do to solve this. bundle exec doesn't solve anything.
You either need to run the command in the context of the bundle (recommended):
> bundle exec rake db:version
Or you need to uninstall the offending rake gem version.
> gem uninstall rake
> # pick version 10.1.0 from the offered choices.
I ran into this same type of error. Try this:
bundle exec rake db:migrate