0

我使用 RVM 安装 ruby​​ 2.2.3。它成功安装,但是当我运行 gem install rails (或任何与此相关的 gem)时,它给了我这个错误:

$ 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 ) 上有一个较旧的未解决问题,看起来与我得到的非常相似,但从未找到答案。

4

1 回答 1

0

此问题的修复方法是确保您libffi-devel也安装,然后重新安装 ruby​​。这样就可以正确安装所有需要的 gem,例如 fiddle/win32。

我只是按照相同的过程,它为我修复了一个更新的 Ruby 版本:2.3.1

于 2016-10-15T21:34:15.183 回答