在任何源错误中找不到rack-cache

时间:2011-09-28 04:43:54

标签: ruby-on-rails ruby

我是创建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

我不确定为什么会这样,因为安装了机架缓存。我已经运行了bundle install,但这并没有解决任何问题。

这是我的宝石文件

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)

2 个答案:

答案 0 :(得分: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

对于任何宝石都是如此,而不仅仅是机架缓存。

答案 1 :(得分:0)

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