【问题标题】:Why won't my Gemfile run?为什么我的 Gemfile 无法运行?
【发布时间】:2013-07-23 14:38:03
【问题描述】:

我正在关注 Hartl Ruby on Rails 教程,并且在教程的 section 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]

【问题讨论】:

  • 你应该有关于版本'2.0.0'的引号

标签: ruby-on-rails ruby gemfile


【解决方案1】:

你应该有

ruby '2.0.0'

而不是

ruby 2.0.0

在你的Gemfile

【讨论】:

    【解决方案2】:

    我认为您需要在 2.0.0 前后加上引号。

    类似ruby "2.0.0"

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-04-15
      • 1970-01-01
      • 2015-03-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-17
      相关资源
      最近更新 更多