Ruby-on-rails 您已经激活了 rake 0.9.0,但是您的 Gemfile 需要 rake 0.8.7
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6080040/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
You have already activated rake 0.9.0, but your Gemfile requires rake 0.8.7
提问by Mujah Maskey
I'm trying to run rails project, I get
我正在尝试运行 rails 项目,我得到
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
采纳答案by Mujah Maskey
I thank to Dobry Den, cheers dude. but little more I had to do. here is solution (works for me). I had added
我感谢多布里登,欢呼伙计。但我还没有做更多的事情。这是解决方案(对我有用)。我已经添加了
gem 'rake','0.8.7'
on Gemfile, which was not there, but my new version of rails automatically install rake(0.9.0).
在 Gemfile 上,它不存在,但我的新版本 rails 会自动安装 rake(0.9.0)。
after I had delete rake0.9.0 by gem uninstall rakeand after doing bundle update rake, I can create and migrate database.
在我删除 rake0.9.0gem uninstall rake之后bundle update rake,我可以创建和迁移数据库。
回答by danneu
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".
首先,检查以确保您的 Gemfile 中提到了 rake。如果不是,请添加它,并指定“您已经激活”的版本。
Then, you'll need to tell bundle to update the rake version it's using for your app:
然后,您需要告诉 bundle 更新它用于您的应用程序的 rake 版本:
bundle update rake
It'll update your Gemfile.lockfor you.
它会Gemfile.lock为你更新你的。
回答by Floyd Price
Where you are currently using rake commands like
您目前在何处使用 rake 命令,例如
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.
直到最新版本的 rails 和/或 rake 能够很好地协同工作,情况才会如此。
回答by sj26
Rake 0.9.0 breaks rails.
Rake 0.9.0 打破了轨道。
See here: Rake 0.9.0 'undefined method 'task' '
请参阅此处:Rake 0.9.0 'undefined method 'task' '
Use bundle exec rakeinstead of raketo run rake at the correct version.
使用bundle exec rake而不是rake在正确的版本上运行 rake。
回答by hacksignal
Specify the version that you want in your Gemfile.
在 Gemfile 中指定您想要的版本。
gem 'rake', '0.9.0'
then
然后
bundle update rake
you need to use bundle exec to run your rake task
您需要使用 bundle exec 来运行您的 rake 任务
bundle exec rake db:migrate
回答by subdigit
Oh look, it's the future. For me, it was complaining I had rake 10.x installed when it wanted 0.9.5. Not quite sure, not familiar enough with Ruby to really dig into what happened to the recent version numbers, but what I did was:
哦,看,这是未来。对我来说,它抱怨我在需要 0.9.5 时安装了 rake 10.x。不太确定,对 Ruby 不够熟悉,无法真正深入了解最近版本号发生了什么,但我所做的是:
gem uninstall rake
gem install rake -v 0.9.5
to force the system to install the version of rake that the app wanted (for me it was Octopress).
强制系统安装应用程序想要的 rake 版本(对我来说是 Octopress)。
回答by glacier
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.
请注意,未使用关键字“sudo”(即 sudo bundle install),因为这可能会将您的 gem 放入您的 rails 应用程序可能无法搜索的目录中。
回答by glacier
Add this to your Gemfile
将此添加到您的 Gemfile
# Rake 0.9.0 break Rails.
gem "rake", "!= 0.9.0"
And then uninstall rake-0.9.0
然后卸载rake-0.9.0
回答by Olivier L.
If I understand what you're not asking, you need to open your Gemfilefile and change the line...
如果我明白你没有问什么,你需要打开你的Gemfile文件并更改行...
gem 'rake', '0.8.7'
...to...
...到...
gem 'rake', '0.9.0'

