【问题标题】:rack-cache not found in any of the sources error在任何源错误中找不到机架缓存
【发布时间】:2011-09-28 04:43:54
【问题描述】:

我是创建 Rails 应用程序的新手。我正在经历这个tutorial,并在启动rails 服务器时遇到了这个问题。当我执行命令(rails server 或 bundle exec rails server)时,出现以下错误:

←[31mCould not find rack-cache-1.0.3 in any of the sources←[0m
←[33mRun `bundle install` to install missing gems.←[0m

我不确定为什么会这样,因为安装了 rack-cache。我已经运行了捆绑安装,但这并不能解决任何问题。

这是我的宝石文件

source 'http://rubygems.org'

gem 'rails', '3.1.0'

# Bundle edge Rails instead:
# gem 'rails',     :git => 'git://github.com/rails/rails.git'

gem 'sqlite3'

gem 'json'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails', "  ~> 3.1.0"
  gem 'coffee-rails', "~> 3.1.0"
  gem 'uglifier'
end

gem 'jquery-rails'

# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'ruby-debug'

我的宝石清单是:

abstract (1.0.0)
actionmailer (3.1.0, 3.0.0)
actionpack (3.1.0, 3.0.0)
activemodel (3.1.0, 3.0.0)
activerecord (3.1.0, 3.0.0)
activeresource (3.1.0, 3.0.0)
activesupport (3.1.0, 3.0.9, 3.0.0)
arel (2.2.1, 1.0.1)
bcrypt-ruby (3.0.1 x86-mingw32)
builder (3.0.0, 2.1.2)
bundler (1.0.18)
childprocess (0.2.2)
coffee-rails (3.1.1)
coffee-script (2.2.0)
coffee-script-source (1.1.2)
commonwatir (2.0.2, 1.9.2)
diff-lcs (1.1.2)
erubis (2.7.0, 2.6.6)
execjs (1.2.9)
ffi (1.0.9 x86-mingw32)
firewatir (1.9.4, 1.9.2)
hike (1.2.1)
hoe (2.10.0)
i18n (0.6.0, 0.4.2)
jquery-rails (1.0.14)
mail (2.3.0, 2.2.19)
metaclass (0.0.1)
mime-types (1.16)
mocha (0.9.12)
multi_json (1.0.3)
nokogiri (1.5.0 x86-mingw32)
polyglot (0.3.2)
rack (1.3.3, 1.2.4)
rack-cache (1.1)
rack-mount (0.8.3, 0.6.14)
rack-ssl (1.3.2)
rack-test (0.6.1, 0.5.7)
rails (3.1.0, 3.0.0)
railties (3.1.0, 3.0.0)
rake (0.9.2)
rautomation (0.6.3)
rdoc (3.9.4)
rspec (2.6.0)
rspec-core (2.6.4)
rspec-expectations (2.6.0)
rspec-mocks (2.6.0)
rubigen (1.5.6)
rubyzip (0.9.4)
s4t-utils (1.0.4)
sass (3.1.7)
sass-rails (3.1.2)
selenium-webdriver (2.6.0)
sprockets (2.0.0)
sqlite3 (1.3.4 x86-mingw32)
taglob (1.1.2)
taza (0.8.7)
term-ansicolor (1.0.6)
thor (0.14.6)
treetop (1.4.10)
tzinfo (0.3.29)
uglifier (1.0.3)
user-choices (1.1.6.1)
watir (2.0.2, 1.9.2)
watir-webdriver (0.3.3)
win32-api (1.4.8 x86-mingw32)
win32-process (0.6.5)
win32console (1.3.0 x86-mingw32)
windows-api (0.4.0)
windows-pr (1.2.0)
xml-simple (1.1.0)

【问题讨论】:

    标签: ruby-on-rails ruby


    【解决方案1】:

    确保您没有收到以下任何内容: [/var/lib/gems/1.8/specifications/rack-cache-1.0.3.gemspec] 中的无效 gemspec:规范中的无效日期格式:“2011-08-27 00:00:00.000000000Z”

    如果是这样,请编辑 gemspec 文件并将日期更改为“2011-08-27”,删除 00:00:00.000000000Z

    这对于任何 gem 都是一样的,不仅仅是 rack-cache。

    【讨论】:

      【解决方案2】:

      看起来 rack-cache 1.1 正在加载,但 Rails 正在寻找 1.0.3。由于您的 Gemfile.lock 列表丢失了缩进,因此不清楚哪个 gem 需要它,但您可以尝试将 gem 'rack-cache', '1.0.3'gem 'rack-cache', '~> 1.0.3' 放在 Gemfile 的顶部(在 gem 'rails' 之后)。

      【讨论】:

      • 它说 actionpack 3.1.0 需要 rack-cache ~> 1.03。我尝试将 gem 'rack-cache', '~> 1.0.3' 放在 gem 'rails' 之后的 gemfile 中,就像这样 'source 'rubygems.org' gem 'rails', '3.1.0' gem 'rack -cache', '~> 1.0.3'' 但我仍然得到错误。
      • 所以显然我得到的 gemspec 错误中的无效日期也是一个原因。我通过将现有日期替换为 s.date = %q{2011-05-21} 并启动了 rails 服务器来修复了该错误。
      猜你喜欢
      • 1970-01-01
      • 2015-09-05
      • 2016-04-26
      • 2016-05-28
      • 2015-02-25
      • 2019-07-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多