LoadError:库版本不兼容 - /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/nokogiri-1.8.2/lib/nokogiri/nokogiri.s

Posted

技术标签:

【中文标题】LoadError:库版本不兼容 - /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/nokogiri-1.8.2/lib/nokogiri/nokogiri.so【英文标题】:LoadError: incompatible library version - /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/nokogiri-1.8.2/lib/nokogiri/nokogiri.so 【发布时间】:2018-10-10 12:49:14 【问题描述】:

尝试在生产模式下运行 rake assets 预编译,如下所示。

rake assets:precompile

在 ubuntu 14.04(32 位)和 16.06(32 位)上运行良好。但是在 aws ec2 中的 16.04(64 位)上出现加载错误。

请帮我解决这个问题。

提前致谢。

这是我的完整堆栈跟踪

rake 中止! LoadError:库版本不兼容 - /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/nokogiri-1.8.2/lib/nokogiri/nokogiri.so /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in block in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:259:in load_dependency' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/nokogiri-1.8.2/lib/nokogiri.rb:32:in rescue in <top (required)>' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/nokogiri-1.8.2/lib/nokogiri.rb:28:in ' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in block in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:259:in load_dependency' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/loofah-2.2.2/lib/loofah.rb:3:in <top (required)>' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in block in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:259:in load_dependency' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/rails-html-sanitizer-1.0.4/lib/rails-html-sanitizer.rb:2:in ' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in block in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:259:in load_dependency' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/actionview-5.0.1/lib/action_view/helpers/sanitize_helper.rb:2:in <top (required)>' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in 要求' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in block in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:259:in load_dependency' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/actionview-5.0.1/lib/action_view/helpers.rb:58:in ' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/actionview-5.0.1/lib/action_view/helpers.rb:4:in <module:ActionView>' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/actionview-5.0.1/lib/action_view/helpers.rb:3:in ' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in block in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:259:in load_dependency' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/actionview-5.0.1/lib/action_view/base.rb:5:in <top (required)>' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in block in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:259:in load_dependency' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/public_activity-1.5.0/lib/public_activity/utility/view_helpers.rb:25:in ' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/public_activity-1.5.0/lib/public_activity/utility/view_helpers.rb:2:in <top (required)>' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in 要求' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in block in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:259:in load_dependency' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/public_activity-1.5.0/lib/public_activity.rb:68:in ' /home/ubuntu/learnmusicco/config/application.rb:7:in <top (required)>' /home/ubuntu/learnmusicco/Rakefile:4:in' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/rake-12.3.1/exe/rake:27:in `'

原因:LoadError: cannot load such file -- nokogiri/2.3/nokogiri /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in block in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:259:in load_dependency' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/nokogiri-1.8.2/lib/nokogiri.rb:30:in <top (required)>' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in block in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:259:in load_dependency' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/loofah-2.2.2/lib/loofah.rb:3:in ' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in block in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:259:in load_dependency' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in 要求' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/rails-html-sanitizer-1.0.4/lib/rails-html-sanitizer.rb:2:in <top (required)>' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in block in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:259:in load_dependency' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/actionview-5.0.1/lib/action_view/helpers/sanitize_helper.rb:2:in ' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in block in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:259:in load_dependency' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/actionview-5.0.1/lib/action_view/helpers.rb:58:in <module:Helpers>' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/actionview-5.0.1/lib/action_view/helpers.rb:4:in ' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/actionview-5.0.1/lib/action_view/helpers.rb:3:in <top (required)>' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in 要求' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in block in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:259:in load_dependency' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/actionview-5.0.1/lib/action_view/base.rb:5:in ' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in block in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:259:in load_dependency' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in 要求' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/public_activity-1.5.0/lib/public_activity/utility/view_helpers.rb:25:in <module:PublicActivity>' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/public_activity-1.5.0/lib/public_activity/utility/view_helpers.rb:2:in ' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in block in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:259:in load_dependency' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/activesupport-5.0.1/lib/active_support/dependencies.rb:293:in require' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/public_activity-1.5.0/lib/public_activity.rb:68:in <top (required)>' /home/ubuntu/learnmusicco/config/application.rb:7:in' /home/ubuntu/learnmusicco/Rakefile:4:in <top (required)>' /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/rake-12.3.1/exe/rake:27:in '

【问题讨论】:

你在服务器上安装了 libgmp-dev 吗? 【参考方案1】:

您可以尝试运行gem pristine --all 以在当前环境中自动卸载并重新安装所有已安装的gem。这可能会解决您的问题。

如果这不起作用,请尝试运行 rm -rf `rvm gemdir`/bundler/gems 以强制删除所有宝石,然后尝试另一个 bundle install

【讨论】:

我不得不运行bundle pristine,但这个答案肯定为我指明了正确的方向。非常感谢! +1 for bundle pristine 在 2020 年使用较旧的 2.5.1 设置,不断抛出 incompatible library version。尝试卸载 nokogiri 并重新安装,但这在 pristine 工作的地方不起作用。

以上是关于LoadError:库版本不兼容 - /home/ubuntu/.rvm/gems/ruby-2.3.1@lm5/gems/nokogiri-1.8.2/lib/nokogiri/nokogiri.s的主要内容,如果未能解决你的问题,请参考以下文章

LoadError:MySQL2 gem 问题,Ubuntu LTS 20.04 上的 libmysqlclient.so.20 版本不正确

conda报错:LoadError: Load Error: in /home/li/.condarc on line 5, column 0. Invalid YAML

未加载库:/opt/local/lib/libssl.1.0.0.dylib (LoadError)

未加载库:/usr/local/opt/readline/lib/libreadline.6.dylib (LoadError)

未加载修复库:libmysqlclient.16.dylib(LoadError)

未加载库:/usr/local/opt/openssl/lib/libssl.1.0.0.dylib (LoadError)