我正在关注Michael Hartl关于第9章的教程(http://www.railstutorial.org/book/updating_and_deleting_users)。
每当我编辑我的Gemfile并手动输入我想安装的gem时,终端在运行bundle install
后一直给我一个语法错误。然后当我粘贴完全相同的文本时,我只需输入我的Gemfile并运行bundle install
,我就不会再出现错误了。
例如,我想安装gem 'faker', '1.1.2'
。当我手动将其输出到Gemfile并运行bundle install
时,我收到语法错误。当我从教程中复制完全相同的文本并粘贴它时,命令会通过。
语法错误
Gemfile syntax error on line 8: no .<digit> floating literal anymore; put 0 before dot
gem ‘faker’, ‘1.1.2’
^
on line 8: syntax error, unexpected tFLOAT, expecting '('
gem ‘faker’, ‘1.1.2’
为什么会发生这种情况,我该如何解决这个问题?
以下是我的Gemfile
source 'https://rubygems.org'
ruby '2.0.0'
#ruby-gemset=railstutorial_rails_4_0
gem 'rails', '4.0.8'
gem 'bootstrap-sass', '2.3.2.0'
gem 'bcrypt-ruby', '~> 3.1.0'
gem 'faker', '1.1.2'
gem 'will_paginate', '3.0.4'
gem 'bootstrap-will_paginate', '0.0.9'
gem 'sprockets', '2.11.0'
gem 'protected_attributes'
gem 'devise', '3.0.0.rc'
group :development, :test do
gem 'spork-rails', '4.0.0'
gem 'guard-spork', '1.5.0'
gem 'childprocess', '0.3.6'
end
group :development, :test do
gem 'sqlite3', '1.3.8'
gem 'rspec-rails', '2.13.1'
gem 'guard-rspec', '2.5.0'
end
group :test do
gem 'selenium-webdriver', '2.35.1'
gem 'capybara', '2.1.0'
gem 'factory_girl_rails', '4.1.0'
# Uncomment this line on OS X.
# gem 'growl', '1.0.3'
# Uncomment these lines on Linux.
# gem 'libnotify', '0.8.0'
# Uncomment these lines on Windows.
# gem 'rb-notifu', '0.0.4'
# gem 'wdm', '0.1.0'
end
gem 'sass-rails', '4.0.1'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.1'
gem 'jquery-rails', '3.0.4'
gem 'turbolinks', '1.1.1'
gem 'jbuilder', '1.0.2'
group :doc do
gem 'sdoc', '0.3.20', require: false
end
group :production do
gem 'pg', '0.15.1'
gem 'rails_12factor', '0.0.2'
end