Bundler:GemNotFound错误,即使gem是本地安装的

时间:2016-04-18 12:08:11

标签: ruby-on-rails-4 rubygems bundler

在我的应用程序中,我使用cron作业来执行简单的模型方法。 这项任务需要一些宝石。 我通过将它包含在gemfile中并运行命令

来安装gem
bundle install

现在,当我运行服务器时,出现以下错误:

/home/aditya9509/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.10.5/lib/bundler/spec_set.rb:92:in `block in materialize': Could not find mime-types-data-3.2016.0221 in any of the sources (Bundler::GemNotFound)
from /home/aditya9509/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.10.5/lib/bundler/spec_set.rb:85:in `map!'
from /home/aditya9509/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.10.5/lib/bundler/spec_set.rb:85:in `materialize'
from /home/aditya9509/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.10.5/lib/bundler/definition.rb:140:in `specs'
from /home/aditya9509/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.10.5/lib/bundler/definition.rb:185:in `specs_for'
from /home/aditya9509/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.10.5/lib/bundler/definition.rb:174:in `requested_specs'
from /home/aditya9509/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.10.5/lib/bundler/environment.rb:18:in `requested_specs'
from /home/aditya9509/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.10.5/lib/bundler/runtime.rb:13:in `setup'
from /home/aditya9509/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.10.5/lib/bundler.rb:127:in `setup'
from /home/aditya9509/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.10.5/lib/bundler/setup.rb:18:in `<top (required)>'
from /home/aditya9509/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/aditya9509/.rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/aditya9509/Desktop/rubystack-2.0.0-33/projects/cricketStockExchange/config/boot.rb:3:in `<top (required)>'
from bin/rails:8:in `require_relative'
from bin/rails:8:in `<main>'

它说捆绑者无法在任何来源中找到mime-types-data-3.2016.0221 gem。为了检查,我运行了以下命令,该命令提供了与mime相关的本地安装的gems列表:

gem list | grep "mime"

这给出了以下输出:

mime-types (3.0, 2.99, 2.6.2)
mime-types-data (3.2016.0221)

显然,mime-types-data-3.2016.0221是在本地安装的,但是捆绑器无法找到它。有没有解决这个问题。下面是我的Gemfile:

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.4'
# Use mysql as the database for Active Record
gem 'mysql2', '~> 0.3.18'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/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
gem 'whenever', :require => false
# Use ActiveModel has_secure_password
gem 'bcrypt', '~> 3.1.7'
gem 'mime-types-data','~> 3.2016.0221'

# Use Unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'

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

我不确定哪些信息更合适,所以请告诉我,我会根据需要更新我的问题。 谢谢!

1 个答案:

答案 0 :(得分:0)

使用bundle exec rails s运行服务器时问题是否仍然存在?