Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot load such file -- rexml/document (LoadError) #328

Closed
noraj opened this issue May 15, 2021 · 9 comments
Closed

cannot load such file -- rexml/document (LoadError) #328

noraj opened this issue May 15, 2021 · 9 comments

Comments

@noraj
Copy link

noraj commented May 15, 2021

evil-winrm requires winrm.

$ evil-winrm -h
bundler: failed to load command: evil-winrm.rb (evil-winrm.rb)
/usr/share/evil-winrm/vendor/bundle/ruby/3.0.0/gems/winrm-2.3.6/lib/winrm/http/response_handler.rb:15:in `require': cannot load such file -- rexml/document (LoadError)
        from /usr/share/evil-winrm/vendor/bundle/ruby/3.0.0/gems/winrm-2.3.6/lib/winrm/http/response_handler.rb:15:in `<top (required)>'
        from /usr/share/evil-winrm/vendor/bundle/ruby/3.0.0/gems/winrm-2.3.6/lib/winrm/http/transport.rb:16:in `require_relative'
        from /usr/share/evil-winrm/vendor/bundle/ruby/3.0.0/gems/winrm-2.3.6/lib/winrm/http/transport.rb:16:in `<top (required)>'
        from /usr/share/evil-winrm/vendor/bundle/ruby/3.0.0/gems/winrm-2.3.6/lib/winrm/http/transport_factory.rb:15:in `require_relative'
        from /usr/share/evil-winrm/vendor/bundle/ruby/3.0.0/gems/winrm-2.3.6/lib/winrm/http/transport_factory.rb:15:in `<top (required)>'
        from /usr/share/evil-winrm/vendor/bundle/ruby/3.0.0/gems/winrm-2.3.6/lib/winrm/connection.rb:16:in `require_relative'
        from /usr/share/evil-winrm/vendor/bundle/ruby/3.0.0/gems/winrm-2.3.6/lib/winrm/connection.rb:16:in `<top (required)>'
        from /usr/share/evil-winrm/vendor/bundle/ruby/3.0.0/gems/winrm-2.3.6/lib/winrm.rb:17:in `require_relative'
        from /usr/share/evil-winrm/vendor/bundle/ruby/3.0.0/gems/winrm-2.3.6/lib/winrm.rb:17:in `<top (required)>'
        from evil-winrm.rb:8:in `require'
        from evil-winrm.rb:8:in `<top (required)>'
        from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.2.17/lib/bundler/cli/exec.rb:63:in `load'
        from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.2.17/lib/bundler/cli/exec.rb:63:in `kernel_load'
        from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.2.17/lib/bundler/cli/exec.rb:28:in `run'
        from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.2.17/lib/bundler/cli.rb:494:in `exec'
        from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.2.17/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
        from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.2.17/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
        from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.2.17/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
        from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.2.17/lib/bundler/cli.rb:30:in `dispatch'
        from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.2.17/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
        from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.2.17/lib/bundler/cli.rb:24:in `start'
        from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.2.17/exe/bundle:49:in `block in <top (required)>'
        from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.2.17/lib/bundler/friendly_errors.rb:130:in `with_friendly_errors'
        from /usr/lib/ruby/gems/3.0.0/gems/bundler-2.2.17/exe/bundle:37:in `<top (required)>'
        from /usr/bin/bundle:23:in `load'
        from /usr/bin/bundle:23:in `<main>'

Is is due because rexml should be a runtime dependency and not a dev one?

require 'rexml/document' unless defined?(REXML::Document)

or because an incompatibility was brought by the last version of rexml because the version is not locked in the gemspec?

@OscarAkaElvis
Copy link

It seems doing gem install rexml fixes the problem. The reason is that before, rexml was a "default gem" and from ruby 3 or higher is a "bundled gem". Is explained here: https://stackoverflow.com/questions/65479863/rails-6-1-ruby-3-0-0-tests-error-as-they-cannot-load-rexml

Probably we should add it to evil-winrm Gemfile and Gemfile.lock.

@OscarAkaElvis
Copy link

We did a commit to fix this on future version: Hackplayers/evil-winrm@83bc6ec

@noraj
Copy link
Author

noraj commented May 19, 2021

It seems doing gem install rexml fixes the problem. The reason is that before, rexml was a "default gem" and from ruby 3 or higher is a "bundled gem". Is explained here: https://stackoverflow.com/questions/65479863/rails-6-1-ruby-3-0-0-tests-error-as-they-cannot-load-rexml

Yes but since it's loaded at runtime it should be added as add_runtime_dependency rather than add_development_dependency in the gemspec.

@OscarAkaElvis
Copy link

Please, enable private messages on twitter or contact me on IRC or Discord (OscarAkaElvis#3764) to keep talking about this further.

@noraj
Copy link
Author

noraj commented May 19, 2021

I'll try to PM you on discord else https://docs.github.com/en/discussions

@OscarAkaElvis
Copy link

To add it as a runtime dependency is something that WinRM staff should do. From our side (evil-winrm team) already did a commit to fix it. Let's see what WinRM staff do.

@postmodern
Copy link
Contributor

Also just ran into this. I think winrm should add rexml as a dependency since it's using it, Users and package managers will increasingly switch to Ruby 3.x and adding rexml as a dependency means you will get newer versions of the library.

@fanbyprinciple
Copy link

actually for me gem install winrm and gem install winrm-fs solved the issue

@mwrock
Copy link
Member

mwrock commented Jul 1, 2022

oh yes fixed in #334

@mwrock mwrock closed this as completed Jul 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants