Onemonth Rails教程gemfile不会让我捆绑安装

时间:2014-06-17 00:22:54

标签: ruby-on-rails

我正在做一个月的导轨教程,遇到一些我似乎无法修复的小问题。我无法获得一些引导功能来在这个简单的网站上进行编辑,所以认为这是宝石没有更新的问题,我去了引导网站,我试图更新它的宝石说是[宝石' bootstrap-sass','〜> 3.1.1']所以

在我的宝石文件中,我只是从

开始
gem 'bootstrap-sass'  

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

还注意到教程在gem文件中有这个代码

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

所以我补充说, 捆绑安装,重启rails服务器 没有解决问题,所以尝试回到以前的问题,并在下面得到一个错误..

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

继承人我的宝石文件现在是什么样子,我正在尝试捆绑安装并推送到heroku但这个错误消息不会让我失望。

下面的GEM文件

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

我是否应该阅读Hartl的Rails书籍以便更好地理解?

1 个答案:

答案 0 :(得分:4)

您在Gemfile中指定了gem 'sdoc'两次,导致错误的版本不同:

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

见下文:

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

删除不需要的那个并运行bundle install