【问题标题】:Rails rake updating issue - Could not find rake-10.4.2 in any of the sourcesRails rake 更新问题 - 在任何来源中都找不到 rake-10.4.2
【发布时间】:2015-02-21 01:47:27
【问题描述】:

我正在尝试(没有多大成功)在 rails 项目上运行 rake db:migrate,但是它返回:

Could not find rake-10.4.2 in any of the sources
Run bundle install to install missing gems.

我运行 bundle install 并且工作正常 - 安装了 rake 10.4.2,但是当我运行时:rake --version(由于某种原因你不能执行 rake -v ???)它显示:rake, version 0.9.6

我运行了 bundle update rake 并返回了我的宝石列表,然后:Your bundle is updated!

为什么 rake 不更新?我做错了什么吗(顺便说一句,我是 Rails 新手-所以这可能真的很简单)

非常感谢任何帮助

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-4 gem rake bundler


    【解决方案1】:

    TL;博士:gem install rake -v '10.4.2'

    所以,我自己也遇到了这个问题。我想知道为什么rails s 昨天可以工作而不是今天。

    首先我检查了我是否在正确的目录中,我是。 然后我重新运行bundle install 以确保安装了 rake。是的,我可以在我的 Gemfile.lock 中看到它 所以我认为我的 gemset 可能已损坏(我使用 RVM)。 rvm gemset empty 然后bundle install

    不过,每当我运行 rails s 时,我都会收到此错误。 bin/rails s 工作,以及 bundle exec rails s。但我不想要前缀,我想要 rails 工作(它适用于其他 rails 项目)

    最终我尝试了gem install rake,它成功了!我建议将 -v '10.4.2' 添加到命令中,以便获得正确的 rake 版本。现在,当我 which rake 时,我得到了我的项目的 gemset:"/Users/cm022291/.rvm/gems/ruby-2.2.1@project_gemset/bin/rake"

    当我运行rails s 时,服务器启动成功。

    【讨论】:

      【解决方案2】:

      尝试输入

      bundle exec rake db:migrate
      

      这将确保被调用的 Rake 是您捆绑的那个。

      【讨论】:

      • hmmm - 我收到一个错误:rake aborted! LoadError: dlopen(/Users/TomHill/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/x86_64-darwin13.0.0/openssl.bundle, 9): Symbol not found: _SSLv2_client_method Referenced from: /Users/TomHill/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/x86_64-darwin13.0.0/openssl.bundle - 加上大量其他文件路径? - 感谢您的帮助!
      • 自从您安装了 Ruby 后,您是否更新了 OpenSSL?对我来说似乎是 OpenSSL 链接失败。
      • 我的 OpenSSL 是:OpenSSL 0.9.8za 5 Jun 2014 - 可以执行 rake 吗?
      • 这不是真正的问题。看看这个 - stackoverflow.com/questions/25492787/… 。你需要重建你的 Ruby。
      • 感谢您的建议 - 运行 rbenv install 2.0.0-p247 - 然后运行 ​​rake db:migrate 并再次运行 - 在任何来源中都找不到 rake-10.4.2,因此尝试了 brew install ruby - 又没有。 rake --version 仍然显示 0.9.6。 bundle exec rake db:migrate 仍然显示:LoadError: dlopen - 非常感谢您对此提供的帮助
      猜你喜欢
      • 2023-03-12
      • 2015-03-08
      • 2015-03-04
      • 2014-03-02
      • 2012-03-30
      • 1970-01-01
      • 2013-12-25
      • 2017-07-18
      • 2012-07-22
      相关资源
      最近更新 更多