在嘗試重新啟動使用 ruby?? 2.7.5p203(2021-11-24 修訂版 f69aeb8314)[x86_64-linux] 的官方 Redmine 4.2.3 docker 容器后,我遇到了一個奇怪的問題。
我一直在運行我寫的一個插件,它使用了這里找到的 quickbooks-ruby gem多年來沒有問題,但是現在我收到以下錯誤:
NoMethodError: undefined method `dependency' for Gzip:Class
/usr/local/bundle/gems/quickbooks-ruby-1.0.19/lib/quickbooks/faraday/middleware/gzip.rb:15:in `<class:Gzip>'
/usr/local/bundle/gems/quickbooks-ruby-1.0.19/lib/quickbooks/faraday/middleware/gzip.rb:14:in `<top (required)>'
/usr/local/bundle/gems/quickbooks-ruby-1.0.19/lib/quickbooks-ruby.rb:16:in `require'
/usr/local/bundle/gems/quickbooks-ruby-1.0.19/lib/quickbooks-ruby.rb:16:in `<top (required)>'
/usr/src/redmine/config/application.rb:18:in `<top (required)>'
/usr/src/redmine/Rakefile:5:in `<top (required)>'
/usr/local/bundle/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
(See full trace by running task with --trace)
這是/lib/quickbooks/faraday/middleware/gzip.rb的前 15 行
# https://github.com/lostisland/faraday_middleware/blob/master/lib/faraday_middleware/gzip.rb
require 'faraday'
# Middleware to automatically decompress response bodies. If the
# "Accept-Encoding" header wasn't set in the request, this sets it to
# "gzip,deflate" and appropriately handles the compressed response from the
# server. This resembles what Ruby 1.9 does internally in Net::HTTP#get.
#
# This middleware is NOT necessary when these adapters are used:
# - net_http on Ruby 1.9
# - net_http_persistent on Ruby 2.0
# - em_http
class Gzip < Faraday::Middleware
dependency 'zlib'
看來我的問題是依賴宣告,我不太確定如何解決這個問題。
請提前告知并感謝您-ricky
uj5u.com熱心網友回復:
看起來 quickbooks-ruby 依賴于 faraday_middleware:1.2.0,。沒有指定這個,所以 faraday:2.xx 被安裝了。要解決此問題,您可以嘗試添加
gem 'faraday_middleware', '1.2.0'
到您的 redmine_qbo Gemfile。
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/428043.html
標籤:轨道上的红宝石 红宝石 红宝石 ruby-on-rails-5
上一篇:將std::plus作為引數傳遞
