简体   繁体   中英

Onemonth Rails tutorial gemfile won't let me bundle install

I'm doing the one month rails tutorial, coming across small issues I can't seem to fix. I couldn't get some of the bootstrap features to work for making edits on this simple site, so thinking it was a problem with the gem being not updated, I went to the bootstrap site and i tried to update a gem which it said was [gem 'bootstrap-sass', '~> 3.1.1'] so

In my gem file I went from just having

gem 'bootstrap-sass'  

to

gem 'bootstrap-sass', '~> 3.1.1'

also noticed the tutorial had this code in the gem file

group :doc do
        #bundle exec rake doc:rails generates the API under doc/api
   gem 'sdoc', require: false
   end

so I added that as well, bundle installed, restarted rails server that didn't fix the problem so tried going back to what was before and got an error below..

   You cannot specify the same gem twice with different version requirements.
   You specified: sdoc (~> 0.4.0) and sdoc (>= 0)

heres what my gem file looks like now, I am trying to bundle install and push to heroku but this error message won't let me.

GEM FILE below

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.0'
# Use sqlite3 as the database for Active Record
#gem 'sqlite3' #it told me i had 2 versions so i commented out for now
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer',  platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0',          group: :doc

# Spring speeds up development by keeping your application running in the background. 
            Read 
more: https://github.com/rails/spring
gem 'spring',        group: :development

gem 'bootstrap-sass', '~> 3.1.1'

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


group :production do
    gem 'pg'
    gem 'rails_12factor'
end



group :doc do
#   bundle exec rake doc:rails generates the API under doc/api
gem 'sdoc', require: false
end

Should I just read the Rails book from Hartl for a better understanding under the hood?

You have specified gem 'sdoc' twice in your Gemfile with different versions which is causing the error:

You cannot specify the same gem twice with different version requirements.
You specified: sdoc (~> 0.4.0) and sdoc (>= 0)

See below:

source 'https://rubygems.org'
##...
##... 
gem 'sdoc', '~> 0.4.0',          group: :doc ##<-- First
##...
##...
group :doc do
#   bundle exec rake doc:rails generates the API under doc/api
gem 'sdoc', require: false    ##<-- Second
end

Remove the one which is not required and run bundle install

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