【问题标题】:Could not find rake-12.2.1 in any of the sources (Bundler::GemNotFound)在任何源中都找不到 rake-12.2.1 (Bundler::GemNotFound)
【发布时间】:2018-04-08 21:45:08
【问题描述】:

运行rails g controller 命令后,我发现这是我的错误:

在任何源中都找不到 rake-12.2.1 (Bundler::GemNotFound)

/usr/lib/ruby/vendor_ruby/bundler/spec_set.rb:87:in block in materialize': Could not find rake-12.2.1 in any of the sources (Bundler::GemNotFound) from /usr/lib/ruby/vendor_ruby/bundler/spec_set.rb:81:inmap!'从 /usr/lib/ruby/vendor_ruby/bundler/spec_set.rb:81:in materialize' from /usr/lib/ruby/vendor_ruby/bundler/definition.rb:159:inspecs' 来自 /usr/lib/ruby/vendor_ruby/bundler/definition.rb:218:in specs_for' from /usr/lib/ruby/vendor_ruby/bundler/definition.rb:207:in requested_specs' 来自 /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:109:in block in definition_method' from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:21:insetup' 来自 /usr/lib/ruby/vendor_ruby/bundler.rb:101:in setup' from /usr/lib/ruby/vendor_ruby/bundler/setup.rb:20:in' 从 /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in require' from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in require' 来自 /root/Desktop/blog/vendor/bundle/ruby/2.3.0/gems/spring-2.0.2/lib/spring/commands.rb:33:in <module:Spring>' from /root/Desktop/blog/vendor/bundle/ruby/2.3.0/gems/spring-2.0.2/lib/spring/commands.rb:4:in ' 来自 /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in require' from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in require' 来自 /root/Desktop/blog/vendor/bundle/ruby/2.3.0/gems/spring-2.0.2/lib/spring/server.rb:9:in <top (required)>' from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in require' 来自 /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in require' from /root/Desktop/blog/vendor/bundle/ruby/2.3.0/gems/spring-2.0.2/lib/spring/client/server.rb:9:in call' 来自 /root/Desktop/blog/vendor/bundle/ruby/2.3.0/gems/spring-2.0.2/lib/spring/client/command.rb:7:in call' from /root/Desktop/blog/vendor/bundle/ruby/2.3.0/gems/spring-2.0.2/lib/spring/client.rb:30:in run' 来自 /root/Desktop/blog/vendor/bundle/ruby/2.3.0/gems/spring-2.0.2/bin/spring:49:in `'

【问题讨论】:

  • 你运行bundle install了吗?尝试使用bundle exec 运行它。
  • 我已经完成了
  • gem install rake
  • 把它放在你的 gem 文件中 gem install rake -v '12.2.1'

标签: ruby-on-rails ruby


【解决方案1】:

我遇到了同样的问题。我通过选择不同版本的 ruby​​ SDK 来修复它。在我的情况下,它是通过选择 2.4.2 而不是 2.3.3,我相信它默认安装在 mac os 上。

【讨论】:

    猜你喜欢
    • 2012-04-19
    • 2015-03-04
    • 2014-07-11
    • 2019-11-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-08
    • 1970-01-01
    相关资源
    最近更新 更多