您的捆绑包已锁定为 rake (12.0.0),但在您的 Gemfile 中列出的任何来源中都找不到该版本。

Your bundle is locked to rake (12.0.0), but that version could not be found in any of the sources listed in your Gemfile.

我在启动 rails 服务器时收到以下错误消息:

Your bundle is locked to rake (12.0.0), but that version could not be found in any of the sources listed in your Gemfile. If you haven't changed sources, that means the author of rake (12.0.0) has removed it. You'll need to update your bundle to a different version of rake (12.0.0) that hasn't been removed in order to install.

我在 gemfile 中指定了 gem 'rake', '12.0.0',但这并没有解决问题。我试过 bundle update rake,删除 Gemfile.lock 并用 bundle exec bundle install 生成它。我还将 `bundle exec1 添加到我的所有命令中,这些命令什么都不做。

我的Gemfile.lock已经指定rake版本12.0.0,没有安装其他版本

查看我的 gemfile: http://pastebin.com/L4tVFWz9

和 rakefile: http://pastebin.com/K7p2ajsE

我尝试了 Already activated rake version different than what Gemfile requires prevents rake commands

中建议的解决方案

尝试:

gem 安装 rubygems-bundler

gem regenerate_binstubs

解决这个问题的不同方法,

第一步:

gem install rubygems-bundler
gem regenerate_binstubs

第二步:

删除 vendor/bundle 目录。

运行 bundle install 重建它

第三步:

试试,gem update bundler

Here is a link where the issue got solved. Check this is very useful

不是真正的根本解决方案,但如果您确实需要 运行 一些 Rails 紧急命令并且需要临时修复,请尝试 bundle exec rails c 而不是 bin/rails c

输入命令:-

bundle update rake