我挑战自己尝试学习Ruby on Rails,并开发一个基本的自举网站。我来自Java,如果有帮助的话。
我已经按照多个教程,观看了很多视频,但是我很难开始使用Ruby on Rails。
详细说明:
which ruby
时,我得到/usr/bin/Ruby
。which rails
时,我会收到/usr/bin/rails
。当我rails -v
或rails 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
或bundle 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.
我正在使用的教程是:
另外,我正在阅读Rails如何使用SQLLite进行本地数据库测试。这会影响我使用Mongo的能力吗?我最近学会了如何使用它,并且已经开始将它用于我正在处理的一个小项目。
答案 0 :(得分:4)
与Cygwin一起去的任何特殊原因?这可能不是您可能想要的答案,但如果您确实需要使用Windows,则更容易使用Rails Installer。另一个免费且有用的选项是下载Virtual Box,安装它,然后安装Linux的副本。 Linux Mint是一个非常简单的发行版,或旧的备用Ubnuntu。
答案 1 :(得分:0)
我发现Windows上的rails速度非常慢+你没有针对生产环境的问题。
虚拟机将更容易,更快。
答案 2 :(得分:-1)
我想回答我刚才发布的问题。已经有一段时间了,但我最终放弃了Windows,只是用Ubuntu双启动。目前我使用的是Macbook。我必须说,使用基于Linux的操作系统来玩Ruby和Rails要容易得多。