这是我的宝石文件:
source 'https://rubygems.org'
gem 'rails', '3.2.14'
#gem 'jquery-rails', '2.0.2'
#gem 'bootstrap-sass', '2.1'
#gem 'bcrypt-ruby', '3.0.1'
gem 'faker', '1.0.1'
gem 'will_paginate', '3.0.3'
gem 'bootstrap-will_paginate', '0.0.6'
group :development, :test do
gem 'sqlite3', '1.3.5'
gem 'rspec-rails', '2.11.0'
gem 'guard-rspec', '1.2.1'
# gem 'guard-spork', '1.2.0'
# gem 'childprocess', '0.3.6'
# gem 'spork', '0.9.2'
end
group :assets do
gem 'saas-rails', '3.2.5'
gem 'coffee-rails', '3.2.2'
gem 'uglifier', '1.2.3'
end
group :test do
gem 'capybara', '1.1.2'
gem 'factory_girl_rails', '4.1.0'
# gem 'cucumber-rails', '1.2.1', :require => false
# gem 'database_cleaner', '0.7.0'
# gem 'launchy', '2.1.0'
# gem 'rb-fsevent', '0.9.1', :require => false
# gem 'growl', '1.0.3'
end
group :production do
gem 'pg', '0.12.2'
end
我一直收到此错误
Nicole-DO-NOT-USE:sample_app nicole$ bundle --without production
/Users/nicole/rails_projects/sample_app/Gemfile:1: warning: encountered \r in middle of line, treated as a mere space
Gemfile syntax error on line 1: syntax error, unexpected tIDENTIFIER, expecting end-of-input
#gem 'jque...'3.2.14'ems.org'
... ^
当我注释掉或删除语法问题所在的行时,仍会出现相同的错误,就像它的'jquery line'一样。我也检查了空白区域,没有运气。有什么想法吗?
答案 0 :(得分:1)
输出中的这一行是为了警告你文件中有一个迷路回车:
/Users/nicole/rails_projects/sample_app/Gemfile:1: warning: encountered \r in middle of line, treated as a mere space
这可能发生在例如来自不同操作系统的文件中(OS X使用CR,Windows使用CR LF,Unix / Linux使用LF(换行)来指示行尾。)您应该尝试将文件转换为您的操作系统的格式。
Sublime Text例如有一个插件可以做到:https://github.com/SublimeText/LineEndings
编辑:关于行结尾的更多信息:
阅读此问题的答案,以获得更详尽的解释:Difference between CR LF, LF and CR line break types?