警告:运行bundle exec rake时已经初始化了常量Gem :: VERSION

时间:2014-09-22 23:24:48

标签: ruby-on-rails bundle gemfile

在我的Rails应用程序中,我尝试运行:

bundle exec rake -P RAILS_ENV=production

我收到以下错误:

/Users/homm/.rvm/gems/ruby-2.1.2/gems/gem-0.0.1.alpha/lib/gem.rb:9: warning: already initialized constant Gem::VERSION
/Users/homm/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems.rb:11: warning: previous definition of VERSION was here
/Users/homm/.rvm/gems/ruby-2.1.2/gems/gem-0.0.1.alpha/lib/gem/requirement.rb:9: warning: already initialized constant Gem::Version::Requirement
/Users/homm/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/requirement.rb:269: warning: previous definition of Requirement was here
/Users/homm/.rvm/gems/ruby-2.1.2/gems/gem-0.0.1.alpha/lib/gem/platform.rb:2: warning: already initialized constant Gem::Platform::RUBY
/Users/homm/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/platform.rb:195: warning: previous definition of RUBY was here
rake aborted!
LoadError: cannot load such file -- gem/require
/Users/homm/.rvm/gems/ruby-2.1.2/gems/gem-0.0.1.alpha/lib/gem.rb:249:in `require'
/Users/homm/.rvm/gems/ruby-2.1.2/gems/gem-0.0.1.alpha/lib/gem.rb:249:in `<top (required)>'
/Users/homm/.rvm/gems/ruby-2.1.2/gems/bundler-1.7.2/lib/bundler/runtime.rb:76:in `require'
/Users/homm/.rvm/gems/ruby-2.1.2/gems/bundler-1.7.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
/Users/homm/.rvm/gems/ruby-2.1.2/gems/bundler-1.7.2/lib/bundler/runtime.rb:72:in `each'
/Users/homm/.rvm/gems/ruby-2.1.2/gems/bundler-1.7.2/lib/bundler/runtime.rb:72:in `block in require'
/Users/homm/.rvm/gems/ruby-2.1.2/gems/bundler-1.7.2/lib/bundler/runtime.rb:61:in `each'
/Users/homm/.rvm/gems/ruby-2.1.2/gems/bundler-1.7.2/lib/bundler/runtime.rb:61:in `require'
/Users/homm/.rvm/gems/ruby-2.1.2/gems/bundler-1.7.2/lib/bundler.rb:133:in `require'
/Users/homm/Projectes/testapp/config/application.rb:14:in `<top (required)>'
/Users/homm/Projectes/testapp/Rakefile:4:in `require'
/Users/homm/Projectes/testapp/Rakefile:4:in `<top (required)>'
/Users/homm/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `eval'
/Users/homm/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `<main>'

我有以下Gemfile:

source 'https://rubygems.org'

ruby '2.1.2'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.0'

# Use sqlite3 as the database for Active Record
group :test, :development do
  gem 'sqlite3'
end

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

gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
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

group :development, :test do
  gem 'rspec-rails', '~> 3.1.0'
  gem 'guard-rspec', '~> 4.3.1'
  gem 'factory_girl_rails', '~> 4.4.1'
  gem 'capybara', '~> 2.4.1'
end

gem 'slim', '~> 2.0.3'
gem 'devise', '~> 3.3.0'
gem "paperclip", "~> 4.2"

# Bootstrap
gem 'libv8'
gem "therubyracer"
gem "less-rails" 
gem "twitter-bootstrap-rails"

而且我不确定发生了什么。我试图推送到Heroku时发现了这个错误,然后我尝试在我的本地机器中重现......

2 个答案:

答案 0 :(得分:0)

检查您是否不小心将其添加到您的Gemfile中并将其删除

gem 'gem'

答案 1 :(得分:0)

在我的情况下,将gem 'openssl'添加到我的Gemfile中修复了它(RVM,使用了autolibs)。