Rails -v给了我错误,我找到的唯一解决方案给出了不同的错误

时间:2013-05-02 22:54:15

标签: ruby-on-rails ruby bundler

我正在尝试按照教程启动并运行但是我在大约2年前尝试过使用Hartl书失败了所以现在我安装了所有这些不同的东西,我不知道它们在哪里,它们是什么,或者如何摆脱它们。我甚至不记得我安装的所有东西。我在OSX 10.6.8

教程说要做rails new issues所以我这样做了,它说我应该看到一堆东西被创建,然后是捆绑器。我没有看到捆绑者。我在另一个SO帖子上找到了一些说明,并按照它们来解决此错误:

xxxx-xxxx-macbook-pro:issues Ryan$ bundle install
Fetching gem metadata from http://rubygems.org/...........
Fetching gem metadata from http://rubygems.org/..
Resolving dependencies...
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
rails (= 3.0.1) ruby depends on
  bundler (~> 1.0.0) ruby
Current Bundler version:
bundler (1.3.5)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?

现在如果我做rails -v我就明白了:

/Users/Ryan/.rvm/gems/ruby-1.9.2-p318@rails3tutorial/gems/bundler-1.3.5/lib/bundler/resolver.rb:130:in `block in resolve': Bundler could not find compatible versions for gem "bundler": (Bundler::VersionConflict)
In Gemfile:
rails (= 3.0.1) ruby depends on
  bundler (~> 1.0.0) ruby
Current Bundler version:
bundler (1.3.5)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
from /Users/Ryan/.rvm/gems/ruby-1.9.2-p318@rails3tutorial/gems/bundler-1.3.5/lib/bundler/resolver.rb:128:in `catch'
from /Users/Ryan/.rvm/gems/ruby-1.9.2-p318@rails3tutorial/gems/bundler-1.3.5/lib/bundler/resolver.rb:128:in `resolve'
from /Users/Ryan/.rvm/gems/ruby-1.9.2-p318@rails3tutorial/gems/bundler-1.3.5/lib/bundler/definition.rb:179:in `resolve'
from /Users/Ryan/.rvm/gems/ruby-1.9.2-p318@rails3tutorial/gems/bundler-1.3.5/lib/bundler/definition.rb:114:in `specs'
from /Users/Ryan/.rvm/gems/ruby-1.9.2-p318@rails3tutorial/gems/bundler-1.3.5/lib/bundler/definition.rb:159:in `specs_for'
from /Users/Ryan/.rvm/gems/ruby-1.9.2-p318@rails3tutorial/gems/bundler-1.3.5/lib/bundler/definition.rb:148:in `requested_specs'
from /Users/Ryan/.rvm/gems/ruby-1.9.2-p318@rails3tutorial/gems/bundler-1.3.5/lib/bundler/environment.rb:18:in `requested_specs'
from /Users/Ryan/.rvm/gems/ruby-1.9.2-p318@rails3tutorial/gems/bundler-1.3.5/lib/bundler/runtime.rb:13:in `setup'
from /Users/Ryan/.rvm/gems/ruby-1.9.2-p318@rails3tutorial/gems/bundler-1.3.5/lib/bundler.rb:120:in `setup'
from /Library/firstapp/issues/config/boot.rb:8:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from script/rails:5:in `<main>'

另一个SO主题是说我是否需要安装捆绑包:

xxxxx-xxxx-macbook-pro:issues Ryan$ gem list bundler
*** LOCAL GEMS ***
bundler (1.3.5, 1.0.22)

因此,自1.0.22表示使用它后我删除了1.3.5

xxxx-xxxx-macbook-pro:issues Ryan$ gem uninstall bundler -v 1.3.5
Successfully uninstalled bundler-1.3.5

无论我是否更新此内容,我都会收到错误。

我很迷茫。我认为rails3tutorial是一年多以前,当我尝试Hartl书和firstapp是我试图把我正在尝试的教程。如果有人有任何线索,我真的很想知道这一点。也许有一天,我甚至可以通过设置并在Ruby On Rails上做一些有效的工作。

2 个答案:

答案 0 :(得分:1)

问题我可能是你过时的rails版本(你使用3.0,3.2是当前版本)。作为一般建议:尽量使用每个宝石的最新版本。

要更新您的宝石/红宝石,请执行

rvm get stable # see the note at the bottom, if that does not work
rvm install 1.9.3 # may take some time
rvm use 1.9.3 --default
gem install bundler
gem install rails
rails new issues

注意:如果rvm get stable不起作用,请查看this SO answer

答案 1 :(得分:0)

幸运的是,你正在使用RVM!您可以从一个干净的平板开始,而不用担心解决旧的依赖关系。你可以安装1.9.3(你在1.9.2上),创建一个干净的gemset,并按照更新的3.2或4.0教程。如果您需要任何帮助,请告诉我。

使用Rails做一些有效的工作。坚持很重要。