简体   繁体   中英

“Gemfile syntax error” after editing Gemfile, running bundle install or bundle update

I am a Rails newbie and trying to follow http://railstutorial.org guide. I am using:

  • gem 2.0.3
  • bundler 1.3.5
  • rails 3.2.13
  • ruby 2.0.0-p195

When I perform bundle update or bundle install after editing the Gemfile, I get the following errors:

roberts-imac-6:first_app bobbaird001$ bundle update
**Gemfile syntax error:**
roberts-imac-6:first_app bobbaird001$ bundle install
**Gemfile syntax error:**

Here is the Gemfile (I have removed the rows that are commented out)

source 'https://rubygems.org'

gem 'rails', '3.2.13'
gem 'sqlite3', '1.3.5'
end
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.2'
  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby
  gem 'uglifier', '>= 1.2.3'cdacd
  end
  gem 'jquery-rails', '2.0.2'
  end

remove the end below sqlite and jquery-rails , remove cdacd at the end of uglifier , and correct the indentation like this:

source 'https://rubygems.org'

gem 'rails', '3.2.13'
gem 'sqlite3', '1.3.5'

group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.2'
  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby
  gem 'uglifier', '>= 1.2.3'
end

gem 'jquery-rails', '2.0.2'

only the gems inside the do blocks need indentation.

hope this helps clarify things.

you have syntax error replace this

gem 'uglifier', '>= 1.2.3'cdacd 

to this

gem 'uglifier', '>= 1.2.3' 

除了@Ruba Ruba提到的其他字符外,基于您问题中的Gemfile,您还有一些额外的结束语句-您实际上只需要在uglifier之后的那一行即可。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM