0

This is my gem file:

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

I keep getting this error

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'
...                               ^

When I comment out or delete the lines where the syntax issue is, the same error still appears as if its the 'jquery line'. I checked for white space as well and no luck. Any ideas?

sawa
  • 165,429
  • 45
  • 277
  • 381

1 Answers1

1

This line in the output is meant to warn you that there is a stray carriage return in your file:

/Users/nicole/rails_projects/sample_app/Gemfile:1: warning: encountered \r in middle of line, treated as a mere space

This can happen for example with files from different operating systems (OS X uses CR, Windows uses CR LF, Unix/Linux uses LF (line feed) to indicate end of line.) You should try converting the file to your operating system's format.

Sublime Text for example has a plugin to do just that: https://github.com/SublimeText/LineEndings

EDIT: A bit more about line endings:

  • \r means "carriage return". It stands for the character Mac OS uses to mark the end of the line.
  • Since the character itself is not visible, "\r" is generally understood to stand for the carriage return character.
  • Unix/Linux uses the "line feed" character for the same purpose
  • Windows uses the combination "carriage return" followed by a "line feed" character to represent line endings.

Read the answers to this question for a more thorough explanation: Difference between CR LF, LF and CR line break types?

Community
  • 1
  • 1
mkis
  • 431
  • 2
  • 8
  • what extension are gem files? Sorry im a newbie. Im using OSX so I save as text edit? – user3726168 Jun 10 '14 at 13:32
  • It's not an extension problem. OSX uses a different character to represent the end of a line. Modern editors usually have a menu setting that let you change what character goes to the end of the line. If you tell us what editor you are using, we can provide specific help. – mkis Jun 10 '14 at 13:34
  • Im uasing Sublime Text – user3726168 Jun 10 '14 at 13:56
  • I really don't understand how to install the plugin. Im not advanced in ROR and don't understand convering the file to the OSX – user3726168 Jun 10 '14 at 14:44
  • how do I solve this /r mere space error? Does anyone know? And if so can you explain detailed Im pretty new at this thanks – user3726168 Jun 10 '14 at 15:00
  • The short version: http://stackoverflow.com/questions/11899843/fixing-sublime-text-2-line-endings the image in this question should show you where to look for the setting. Set it to `View -> Line Endings -> Unix`, save the Gemfile, then try running bundle again. – mkis Jun 10 '14 at 15:18
  • Thanks mkis, are there any other editors that show the /r that are more straight forward (since I don't know how to install plugin) – user3726168 Jun 10 '14 at 15:34
  • I think TextWrangler allows you to change line endings by default: https://en.wikipedia.org/wiki/TextWrangler – mkis Jun 10 '14 at 15:42
  • Thank you for your answer. I tried Github atom 1.5.4 which have a broken default line-ending-converter. then switched to visual studio code 0.10.3 , which have a fully functional default line ending converter. Converting Line ending as you said solved my issues. – Mohamed El-Nakeep Mar 01 '16 at 21:39