简体   繁体   中英

ruby on rails tutorial - gemfile error

I've just started doing the "Ruby on Rails Tutorial", from Michael Hartl. I've created a new project.My Gemfile from given below:

#ruby-gemset=railstutorial_rails_4_0

Gemfile:

gem 'rails', '4.0.8'

group :development do
  gem 'sqlite3', '1.3.8'
end

gem 'sass-rails', '4.0.3'
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

After that I tried to execute in terminal $ bundle install --without production Then I got following error

    nikhil@ubuntu:~/rails_projects/demo_app$ bundle install --without production
/home/nikhil/rails_projects/demo_app/Gemfile:29:in `evaluate': compile error (SyntaxError)
/home/nikhil/rails_projects/demo_app/Gemfile:23: syntax error, unexpected ':', expecting kEND
  gem 'sdoc', '0.3.20', require: false
                                ^
    from /usr/lib/ruby/vendor_ruby/bundler/definition.rb:17:in `build'
    from /usr/lib/ruby/vendor_ruby/bundler.rb:136:in `definition'
    from /usr/lib/ruby/vendor_ruby/bundler/cli.rb:222:in `install'
    from /usr/lib/ruby/vendor_ruby/bundler/vendor/thor/task.rb:22:in `send'
    from /usr/lib/ruby/vendor_ruby/bundler/vendor/thor/task.rb:22:in `run'
    from /usr/lib/ruby/vendor_ruby/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
    from /usr/lib/ruby/vendor_ruby/bundler/vendor/thor.rb:246:in `dispatch'
    from /usr/lib/ruby/vendor_ruby/bundler/vendor/thor/base.rb:389:in `start'
    from /usr/bin/bundle:13

I am a fresher just trying to study RoR please help me to fix this error Thanks

Looking at the comments, the issue is almost certainly caused by the following line in your Gemfile:

#Gemfile
group :doc do
  gem 'sdoc', '0.3.20', require: false
end

According to the answers on the other questions, you will most likely be able to fix the issue by using the following syntax:

#Gemfile
group :doc do
  gem 'sdoc', '0.3.20', :require => false
end

Bundler

Thanks to @mandeep in the comments, you'll also want to look at updating your version of bundler

To do this, you just have to cd into the working directory for your Rails application, and then run:

gem update bundler

This will install the latest version of the bundler gem in your application, which should also go towards resolving the error you're seeing too

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