0

我正在关注 Hartl Ruby on Rails 教程,并且在教程的第 1.2.4 节中

在设置 Rails 应用程序时,它会说运行以下命令:

cd first_app_direcory
sublime Gemfile
bundle update

sublime Gemfile命令显然会编辑 Gemfile,但是当我尝试运行该命令时bundle update,出现以下错误:

bundle update
Gemfile syntax error:
ruby 2.0.0 
         ^
/home/cameron/ruby/ror/first_app/Gemfile:2:
syntax error, unexpected tINTEGER,
expecting '('
ruby 2.0.0 
          ^

我将这两行从 gemfile 中取出,尽管它说要包含它们。此外,我尝试了 Ruby 1.9.3,但仍然收到相同的错误消息。

ruby 2.0.0 
#ruby-gemset=railstutorial_rails_4_0

取出这些线后,它起作用了。我试图让它与 gemfile 中的那些行一起工作。我怎样才能做到这一点?

这是完整的 Gemfile:

source 'https://rubygems.org'
ruby 2.0.0 
#ruby-gemset=railstutorial_rails_4_0

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'

# Use sqlite3 as the database for Active Record
group :developent do
    gem 'sqlite3', '1.3.7'
end

# Use SCSS for stylesheets
gem 'sass-rails', '4.0.0'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '2.1.1'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '4.0.0'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails', '2.2.1'

# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks', '1.1.1'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '1.0.2'

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', '0.3.20',require: false
end

# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano', group: :development

# Use debugger
# gem 'debugger', group: [:development, :test]
4

2 回答 2

7

你应该有

ruby '2.0.0'

代替

ruby 2.0.0

在你的Gemfile.

于 2013-07-23T14:39:25.813 回答
2

我认为您需要在 2.0.0 周围引用。

类似的东西ruby "2.0.0"

于 2013-07-23T14:40:14.423 回答