无法在任何来源中找到json-1.8.3(Bundler :: GemNotFound)

时间:2015-09-29 02:48:11

标签: ruby-on-rails ruby json

我的所有cron作业都出错了,日志是: 该错误不会影响我的Web应用程序,但会影响我的后台作业。 它似乎在我的系统上出错,但不知道如何解决它。 有两个版本的json,我试图卸载它,但json-1.8.1不能,因为它是默认的。 请帮忙。 谢谢!

/root/.rvm/gems/ruby-2.2.0/gems/bundler-1.10.5/lib/bundler/spec_set.rb:92:in `block in materialize': Could not find json-1.8.3 in any of the sources (Bundler::GemNotFound)
from /root/.rvm/gems/ruby-2.2.0/gems/bundler-1.10.5/lib/bundler/spec_set.rb:85:in `map!'
from /root/.rvm/gems/ruby-2.2.0/gems/bundler-1.10.5/lib/bundler/spec_set.rb:85:in `materialize'
from /root/.rvm/gems/ruby-2.2.0/gems/bundler-1.10.5/lib/bundler/definition.rb:140:in `specs'
from /root/.rvm/gems/ruby-2.2.0/gems/bundler-1.10.5/lib/bundler/definition.rb:185:in `specs_for'
from /root/.rvm/gems/ruby-2.2.0/gems/bundler-1.10.5/lib/bundler/definition.rb:174:in `requested_specs'
from /root/.rvm/gems/ruby-2.2.0/gems/bundler-1.10.5/lib/bundler/environment.rb:18:in `requested_specs'
from /root/.rvm/gems/ruby-2.2.0/gems/bundler-1.10.5/lib/bundler/runtime.rb:13:in `setup'
from /root/.rvm/gems/ruby-2.2.0/gems/bundler-1.10.5/lib/bundler.rb:127:in `setup'
from /root/.rvm/gems/ruby-2.2.0/gems/bundler-1.10.5/lib/bundler/setup.rb:18:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/local/rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'

宝石清单:

gem list json

*本地宝石*

json(1.8.3,1.8.1) multi_json(1.11.2)

宝石文件:

gem 'rails', '4.2.0'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'therubyracer', platforms: :ruby

gem 'mysql2', '~> 0.3.18'
gem 'bcrypt', '3.1.7'
gem 'paperclip'
gem "iconv", "~> 1.0.3"
gem 'gravtastic'

gem 'execjs'
gem 'nokogiri'
gem 'twilio-ruby'

gem 'private_pub'
gem 'thin'
gem 'json', '~> 1.8.3'

gem 'redis'
gem 'resque', :require => "resque/server"
gem 'resque-scheduler'
gem 'resque-cleaner'
gem 'redis-mutex'
gem 'redis-classy', '~> 2.2.0'

gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc


group :development, :test do
  gem 'byebug'
  gem 'web-console', '~> 2.0'

  gem 'spring'
  gem 'god'
end

3 个答案:

答案 0 :(得分:3)

如果没有看到有问题的cron工作,很难发表评论。 你正在使用RVM;你是不是可以在你的cron工作中调用正确的红宝石?如果你不是,那就解释了为什么你的网络应用程序工作正常,但你的后台工作失败了。

Missing required gems when execute cron created by whenever gem in production environment

https://coderwall.com/p/vhv8aw/getting-ruby-scripts-working-with-bundler-rvm-and-cron

答案 1 :(得分:1)

我建议将whenever gem用于cron任务。我发现处理gem版本更加可靠,然后你不必担心系统宝石。这应该为你解决问题(我希望)。

答案 2 :(得分:0)

我所有的cron工作现在都在工作。我发现我当前的rvm环境没有在crontab -e上列出。但是,我不知道为什么这条路可能导致上次一切正常。顺便说一句,

我得到了:

First (get path):
`rvm env --path`
Sencondly (add the path like):
`PATH="/root/.rvm/environments/ruby-2.2.0:...."`
Lastly (I updates some Gem version in Gemfile like mysql2 ... then bundle install)

最终,所有后台工作都在重新开始。