RVM无法加载此类文件 - win32 / resolv(LoadError)

时间:2016-05-24 04:54:10

标签: ruby-on-rails ruby cygwin rvm resolv

我使用RVM安装ruby 2.2.3。它已经成功安装,但是当我运行gem install rails(或任何宝石)时,它给了我这个错误:

$ gem install rails
/home/laury/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- win32/resolv (LoadError)
        from /home/laury/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /home/laury/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/resolv.rb:964:in `default_config_hash'
        from /home/laury/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/resolv.rb:982:in `block in lazy_initialize'
        from /home/laury/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/resolv.rb:975:in `synchronize'
        from /home/laury/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/resolv.rb:975:in `lazy_initialize'
        from /home/laury/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/resolv.rb:357:in `block in lazy_initialize'
        from /home/laury/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/resolv.rb:355:in `synchronize'
        from /home/laury/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/resolv.rb:355:in `lazy_initialize'
        from /home/laury/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/resolv.rb:515:in `fetch_resource'
        from /home/laury/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/resolv.rb:509:in `each_resource'
        from /home/laury/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/resolv.rb:490:in `getresource'
        from /home/laury/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/remote_fetcher.rb:92:in `api_endpoint'
        from /home/laury/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/source.rb:46:in `api_uri'
        from /home/laury/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/source.rb:85:in `dependency_resolver_set'
        from /home/laury/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/resolver/best_set.rb:23:in `block in pick_sets'
        from /home/laury/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/source_list.rb:97:in `each'
        from /home/laury/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/source_list.rb:97:in `each_source'
        from /home/laury/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/resolver/best_set.rb:22:in `pick_sets'
        from /home/laury/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/resolver/best_set.rb:28:in `find_all'
        from /home/laury/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/resolver/installer_set.rb:151:in `find_all'
        from /home/laury/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/resolver/installer_set.rb:54:in `add_always_install'
        from /home/laury/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/dependency_installer.rb:473:in `resolve_dependencies'
        from /home/laury/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/commands/install_command.rb:238:in `install_gem'
        from /home/laury/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/commands/install_command.rb:299:in `block in install_gems'
        from /home/laury/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/commands/install_command.rb:295:in `each'
        from /home/laury/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/commands/install_command.rb:295:in `install_gems'
        from /home/laury/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/commands/install_command.rb:202:in `execute'
        from /home/laury/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/command.rb:307:in `invoke_with_build_args'
        from /home/laury/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/command_manager.rb:168:in `process_args'
        from /home/laury/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/command_manager.rb:138:in `run'
        from /home/laury/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/gem_runner.rb:54:in `run'
        from /home/laury/.rvm/rubies/ruby-2.2.3/bin/gem:21:in `<main>'

我使用的是Windows 10 Pro,Cygwin,rvm 1.27.0。在RVM的github(https://github.com/rvm/rvm/issues/3519)上有一个较旧的开放问题,看起来与我得到的非常相似,但是从未找到答案。

1 个答案:

答案 0 :(得分:0)

此问题的解决方法是确保您还安装libffi-devel,然后重新安装ruby。这样就可以正确安装所有需要的宝石,如小提琴/ win32。

我只是遵循相同的过程,并在更新的Ruby版本上为我修复了它:2.3.1