我挑战自己尝试学习 Ruby on Rails,并开发一个基本的自举站点。我来自 Java,如果有帮助的话。
我已经学习了多个教程,观看了很多视频,但是我很难开始使用 Ruby on Rails。
细节:
- 我没有使用 RVM。
- 我在 64 位 Windows 7 上使用 Cygwin。
- 我拥有 Ruby on Rails 所需的所有软件包。
- 我已经删除(或至少尝试过)Rubygems、Rruby 和 Rails 所在的所有其他地方,所以它们都应该在 Cygwin 中。
- 当我输入
which ruby
Cygwin 时,我得到/usr/bin/Ruby
. - 当我输入
which rails
时,我得到/usr/bin/rails
。 - 我不知道如何获得我正在使用的 RubyGems,主要是因为 gems 和其他东西现在对我来说完全陌生,我还没有从教程中走得那么远。
当我执行rails -v
orrails server
时,我收到此错误:
Could not find gem 'sqlite3-ruby (>= 0) ruby' in any of the gem sources listed in your Gemfile.
Try running `bundle install`.
当我执行bundle install
orbundle update
时,我收到一个错误,我似乎找不到其他人得到:
Fetching source index for http://rubygems.org/
/usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/source.rb:253:in `fetch_all_remote_specs': undefined method `list' for #<Gem::SpecFetcher:0x00000600716118> (NoMethodError)
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/source.rb:234:in `block in remote_specs'
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/source.rb:231:in `each'
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/source.rb:231:in `remote_specs'
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/source.rb:165:in `fetch_specs'
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/source.rb:70:in `specs'
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/definition.rb:176:in `block (2 levels) in index'
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/definition.rb:175:in `each'
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/definition.rb:175:in `block in index'
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/index.rb:7:in `build'
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/definition.rb:174:in `index'
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/definition.rb:168:in `resolve'
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/definition.rb:107:in `specs'
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/definition.rb:102:in `resolve_remotely!'
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/installer.rb:43:in `run'
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/installer.rb:8:in `install'
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/cli.rb:219:in `install'
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/vendor/thor/task.rb:22:in `run'
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/vendor/thor.rb:263:in `dispatch'
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/lib/bundler/vendor/thor/base.rb:386:in `start'
from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.0.22/bin/bundle:13:in `<top (required)>'
from /usr/bin/bundle:23:in `load'
from /usr/bin/bundle:23:in `<main>'
I'm fine with installing RVM, though when I do, I'm afraid I'll run into incompatibilities because I'm doing this from Cygwin, and I messed this all up two days ago, I finally got it to get this far.
我正在使用的教程是:
- http://ruby.railstutorial.org/ruby-on-rails-tutorial-book
- YouTube 视频的混合。
另外,我正在阅读 Rails 如何使用 SQLLite 进行本地数据库测试。这会影响我使用 Mongo 的能力吗?我最近学会了如何使用它,并且已经开始将它用于我正在做的一个小项目来记录事情。