我已经将Ruby版本从Ruby 1.8.7升级到2.1.0,并安装了所有依赖项,以便使用Ruby运行示例Appium测试用例。但我在运行测试用例时遇到了加载nokogiri的问题。
我正在使用
操作系统:Mac操作系统-1.9.2
Ruby:2.1.0
应用程序:1.2.0
野村:1.6.3.1
这在Ruby 1.8.7上运行良好。
错误:
Users/.rvm/gems/ruby-2.1.0/ruby/2.1.0/gems/nokogiri-1.6.3.1/lib/nokogiri.rb:29:in `require': dlopen(/Users/.rvm/gems/ruby-2.1.0/ruby/2.1.0/gems/nokogiri-1.6.3.1/lib/nokogiri/nokogiri.bundle, 9): Library not loaded: /Users/.rvm/rubies/ruby-2.1.0/lib/libruby.2.1.0.dylib (LoadError)
Referenced from: /Users/.rvm/gems/ruby-2.1.0/ruby/2.1.0/gems/nokogiri-1.6.3.1/lib/nokogiri/nokogiri.bundle
Reason: image not found - /Users/.rvm/gems/ruby-2.1.0/ruby/2.1.0/gems/nokogiri-1.6.3.1/lib/nokogiri/nokogiri.bundle
from /Users/.rvm/gems/ruby-2.1.0/ruby/2.1.0/gems/nokogiri-1.6.3.1/lib/nokogiri.rb:29:in `rescue in <top (required)>'
from /Users/.rvm/gems/ruby-2.1.0/ruby/2.1.0/gems/nokogiri-1.6.3.1/lib/nokogiri.rb:25:in `<top (required)>'
from /Users/.rvm/gems/ruby-2.1.0/ruby/2.1.0/gems/appium_lib-4.1.0/lib/appium_lib/driver.rb:4:in `require'
from /Users/.rvm/gems/ruby-2.1.0/ruby/2.1.0/gems/appium_lib-4.1.0/lib/appium_lib/driver.rb:4:in `<top (required)>'
from /Users/.rvm/gems/ruby-2.1.0/ruby/2.1.0/gems/appium_lib-4.1.0/lib/appium_lib.rb:28:in `require_relative'
from /Users/.rvm/gems/ruby-2.1.0/ruby/2.1.0/gems/appium_lib-4.1.0/lib/appium_lib.rb:28:in `<top (required)>'
from /Users/Documents/rslRuby/li_workspace/flagship_native_tests/UITestFramework/selenium/base/LI_framework.rb:32:in `require'
from /Users/Documents/rslRuby/li_workspace/flagship_native_tests/UITestFramework/selenium/base/LI_framework.rb:32:in `<top (required)>'
from /Users/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/.rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from samle_tests/sign_in_test.rb:10:in `<main>'
可能的修复1:
这种情况通常发生在gem链接错误时,我建议尝试通过rvm重新安装ruby。
rvm reinstall 2.1
rvm use 2.1
通过运行(在你的应用程序目录中)确保所有的宝石都是最新的
bundle install
可能的修复2:
另一个常见的问题是以root用户身份安装rvm,如果您已经这样做了,请重新安装rvm。
您可以通过运行来卸载rvm
rvm implode
按照网站上的步骤安装rvm