You have already activated rake 0.9.0, but your Ge

2019-01-12 17:02发布

I'm trying to run rails project, I get

Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

If I do: "bundle install"

but I'm getting

You have already activated rake 0.9.0, but your Gemfile requires rake 0.8.7

while doing

rake db:migrate

9条回答
【Aperson】
2楼-- · 2019-01-12 17:41

Specify the version that you want in your Gemfile.

gem 'rake', '0.9.0' 

then

bundle update rake

you need to use bundle exec to run your rake task

bundle exec rake db:migrate
查看更多
狗以群分
3楼-- · 2019-01-12 17:42

If I understand what you're not asking, you need to open your Gemfile file and change the line...

gem 'rake', '0.8.7'

...to...

gem 'rake', '0.9.0'
查看更多
Fickle 薄情
4楼-- · 2019-01-12 17:47

I had this problem (with another gem that was not rake) and I was able to fix it by

gem uninstall <complaining gem>
gem install <complaining gem>

bundle install
bundle update

Note that the keyword 'sudo' was not used (ie. sudo bundle install) as that may place your gem into directories where your rails app might not be searching in.

查看更多
The star\"
5楼-- · 2019-01-12 17:48

Where you are currently using rake commands like

rake db:migrate

Use this instead:

bundle exec rake db:migrate

this will be the case until the latest version of rails and/or rake work well together.

查看更多
做自己的国王
6楼-- · 2019-01-12 17:50

First, check to make sure that rake is mentioned in your Gemfile. If it's not, add it, and specify the version "you already activated".

Then, you'll need to tell bundle to update the rake version it's using for your app:

bundle update rake

It'll update your Gemfile.lock for you.

查看更多
Bombasti
7楼-- · 2019-01-12 17:56

Rake 0.9.0 breaks rails.

See here: Rake 0.9.0 'undefined method 'task' '

Use bundle exec rake instead of rake to run rake at the correct version.

查看更多
登录 后发表回答