Gem intall fails with NoMethodError

Vasanth's Avatar

Vasanth

11 Feb, 2017 12:38 PM

I'm on CentOS 6 and I can't seem to install any gems using gem install command.

$ cat /etc/issue
CentOS release 6.8 (Final)
Kernel \r on an \m

This is what I see when I try to install gem – bundler.

$ rbenv exec gem install rails --explain --debug
NOTE:  Debugging mode prints all exceptions even when rescued
Exception `LoadError' at /home/deploy/.rbenv/versions/2.2.5/lib/ruby/2.2.0/resolv.rb:168 - LoadError
Exception `NoMethodError' at /home/deploy/.rbenv/versions/2.2.5/lib/ruby/2.2.0/resolv.rb:760 - undefined method `[]' for nil:NilClass
ERROR:  While executing gem ... (NoMethodError)
    undefined method `[]' for nil:NilClass
    /home/deploy/.rbenv/versions/2.2.5/lib/ruby/2.2.0/resolv.rb:760:in `recv_reply'
    /home/deploy/.rbenv/versions/2.2.5/lib/ruby/2.2.0/resolv.rb:690:in `request'
    /home/deploy/.rbenv/versions/2.2.5/lib/ruby/2.2.0/resolv.rb:528:in `block in fetch_resource'
    /home/deploy/.rbenv/versions/2.2.5/lib/ruby/2.2.0/resolv.rb:1096:in `block (3 levels) in resolv'
    /home/deploy/.rbenv/versions/2.2.5/lib/ruby/2.2.0/resolv.rb:1094:in `each'
    /home/deploy/.rbenv/versions/2.2.5/lib/ruby/2.2.0/resolv.rb:1094:in `block (2 levels) in resolv'
    /home/deploy/.rbenv/versions/2.2.5/lib/ruby/2.2.0/resolv.rb:1093:in `each'
    /home/deploy/.rbenv/versions/2.2.5/lib/ruby/2.2.0/resolv.rb:1093:in `block in resolv'
    /home/deploy/.rbenv/versions/2.2.5/lib/ruby/2.2.0/resolv.rb:1091:in `each'
    /home/deploy/.rbenv/versions/2.2.5/lib/ruby/2.2.0/resolv.rb:1091:in `resolv'
    /home/deploy/.rbenv/versions/2.2.5/lib/ruby/2.2.0/resolv.rb:519:in `fetch_resource'
    /home/deploy/.rbenv/versions/2.2.5/lib/ruby/2.2.0/resolv.rb:509:in `each_resource'
    /home/deploy/.rbenv/versions/2.2.5/lib/ruby/2.2.0/resolv.rb:490:in `getresource'
    /home/deploy/.rbenv/versions/2.2.5/lib/ruby/2.2.0/rubygems/remote_fetcher.rb:92:in `api_endpoint'
    /home/deploy/.rbenv/versions/2.2.5/lib/ruby/2.2.0/rubygems/source.rb:46:in `api_uri'
    /home/deploy/.rbenv/versions/2.2.5/lib/ruby/2.2.0/rubygems/source.rb:85:in `dependency_resolver_set'
    /home/deploy/.rbenv/versions/2.2.5/lib/ruby/2.2.0/rubygems/resolver/best_set.rb:23:in `block in pick_sets'
    /home/deploy/.rbenv/versions/2.2.5/lib/ruby/2.2.0/rubygems/source_list.rb:97:in `each'
    /home/deploy/.rbenv/versions/2.2.5/lib/ruby/2.2.0/rubygems/source_list.rb:97:in `each_source'
    /home/deploy/.rbenv/versions/2.2.5/lib/ruby/2.2.0/rubygems/resolver/best_set.rb:22:in `pick_sets'
    /home/deploy/.rbenv/versions/2.2.5/lib/ruby/2.2.0/rubygems/resolver/best_set.rb:28:in `find_all'
    /home/deploy/.rbenv/versions/2.2.5/lib/ruby/2.2.0/rubygems/resolver/installer_set.rb:151:in `find_all'
    /home/deploy/.rbenv/versions/2.2.5/lib/ruby/2.2.0/rubygems/resolver/installer_set.rb:54:in `add_always_install'
    /home/deploy/.rbenv/versions/2.2.5/lib/ruby/2.2.0/rubygems/dependency_installer.rb:463:in `resolve_dependencies'
    /home/deploy/.rbenv/versions/2.2.5/lib/ruby/2.2.0/rubygems/commands/install_command.rb:238:in `install_gem'
    /home/deploy/.rbenv/versions/2.2.5/lib/ruby/2.2.0/rubygems/commands/install_command.rb:299:in `block in install_gems'
    /home/deploy/.rbenv/versions/2.2.5/lib/ruby/2.2.0/rubygems/commands/install_command.rb:295:in `each'
    /home/deploy/.rbenv/versions/2.2.5/lib/ruby/2.2.0/rubygems/commands/install_command.rb:295:in `install_gems'
    /home/deploy/.rbenv/versions/2.2.5/lib/ruby/2.2.0/rubygems/commands/install_command.rb:202:in `execute'
    /home/deploy/.rbenv/versions/2.2.5/lib/ruby/2.2.0/rubygems/command.rb:307:in `invoke_with_build_args'
    /home/deploy/.rbenv/versions/2.2.5/lib/ruby/2.2.0/rubygems/command_manager.rb:168:in `process_args'
    /home/deploy/.rbenv/versions/2.2.5/lib/ruby/2.2.0/rubygems/command_manager.rb:138:in `run'
    /home/deploy/.rbenv/versions/2.2.5/lib/ruby/2.2.0/rubygems/gem_runner.rb:54:in `run'
    /home/deploy/.rbenv/versions/2.2.5/bin/gem:21:in `<main>'

Any help would be highly appreciated.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac