DavidWeisburd
DavidWeisburd

Reputation: 23

Gemfile Syntax Error

I get the following error: Gemfile Syntax Error.

Here is my code:

source 'https://rubygems.org'

gem 'rails', '3.2.1'

gem 'devise'

# Bundle bootstrap gems
group :development do
  gem 'thin'

  # Bundle edge Rails instead:
  # gem 'rails', :git => 'git://github.com/rails/rails.git'

  gem 'sqlite3'


# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

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

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

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

# To use Jbuilder templates for JSON
# gem 'jbuilder'

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

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'

Upvotes: 2

Views: 5878

Answers (3)

Jay
Jay

Reputation: 607

I encountered the error several times, but I didn't touch the file generated by rails and ruby -c Gemfile says syntax is Ok. In my case, if rails command can not be found, Gemfile syntax error might be reported.

I use brew+rbenv+ruby 2.0+rails 4 and I use the following commands to get things back to normal.

# new commands in brew-installed ruby might not be linked automatically 
brew unlink ruby && brew link ruby 
# fix "gem" itself
sudo gem update --system
# after installing executable with rbenv, you need rehash
rbenv rehash

Upvotes: 1

Jim Stewart
Jim Stewart

Reputation: 17353

You're missing an end for the do in group :development. Add an end statement on the line after gem 'sqlite3'.

You can run ruby -c Gemfile to check the syntax (it's regular Ruby code), and it'll give you an idea of where the error lies.

Upvotes: 10

Rob Di Marco
Rob Di Marco

Reputation: 45002

It looks like you are missing a end after the development group.

Upvotes: 1

Related Questions