-2

我正在尝试按照教程启动并运行,但大约 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 上做一些富有成效的事情。

4

2 回答 2

1

我的问题可能是您过时的 rails 版本(您使用的是 3.0,3.2 是当前版本)。作为一般建议:尝试使用每个 gem 的最新版本。

要更新您的 gems/ruby,请执行

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不起作用,请查看此 SO answer

于 2013-05-02T23:02:24.170 回答
0

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

使用 Rails 做一些富有成效的事情。坚持很重要。

于 2013-05-02T23:01:24.747 回答