DEV Community

Regular 🍟
Regular 🍟

Posted on

3 3

`cannot load such file -- rexml/document`

Time: 2021-03-29 22:04 UTC+8:00

Author: vonhyou

Cause

rexml gem is a bundled gem since Ruby 3.0.0. So we must add rexml to Gemfile.

On Ruby 2.6 and 2.7, rexml gem is default gem. So default rexml is used if Gemfile does not include rexml. On these versions of ruby, we must add rexml to Gemfile only if we want to use specific rexml version.

Solution

gem 'rexml', '~> 3.2', '>= 3.2.4'
Enter fullscreen mode Exit fullscreen mode

Add the code above to Gemfile

Full log

/Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:34:in `require': cannot load such file -- rexml/document (LoadError)
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:332:in `block in require'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:299:in `load_dependency'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:332:in `require'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/selenium-webdriver-3.142.7/lib/selenium/webdriver/firefox.rb:22:in `<main>'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:332:in `block in require'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:299:in `load_dependency'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:332:in `require'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/webdrivers-4.6.0/lib/webdrivers/geckodriver.rb:72:in `<main>'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:332:in `block in require'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:299:in `load_dependency'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:332:in `require'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/webdrivers-4.6.0/lib/webdrivers.rb:4:in `<main>'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bundler-2.2.14/lib/bundler/runtime.rb:66:in `block (2 levels) in require'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bundler-2.2.14/lib/bundler/runtime.rb:61:in `each'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bundler-2.2.14/lib/bundler/runtime.rb:61:in `block in require'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bundler-2.2.14/lib/bundler/runtime.rb:50:in `each'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bundler-2.2.14/lib/bundler/runtime.rb:50:in `require'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/bundler-2.2.14/lib/bundler.rb:173:in `require'
        from /Users/toreality/RubymineProjects/sample_app/config/application.rb:7:in `<top (required)>'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/spring-2.1.1/lib/spring/application.rb:92:in `require'                      
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/spring-2.1.1/lib/spring/application.rb:92:in `preload'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/spring-2.1.1/lib/spring/application.rb:157:in `serve'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/spring-2.1.1/lib/spring/application.rb:145:in `block in run'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/spring-2.1.1/lib/spring/application.rb:139:in `loop'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/spring-2.1.1/lib/spring/application.rb:139:in `run'
        from /Users/toreality/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/spring-2.1.1/lib/spring/application/boot.rb:19:in `<top (required)>'
        from <internal:/Users/toreality/.rbenv/versions/3.0.0/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from <internal:/Users/toreality/.rbenv/versions/3.0.0/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from -e:1:in `<main>'
Enter fullscreen mode Exit fullscreen mode

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here β†’

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay