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.

  1. Support Staff 1 Posted by Aditya Prakash on 26 Feb, 2017 05:46 AM

    Aditya Prakash's Avatar

    Hi Vasanth,

    Can you please let us know which rubygems version are you using? Please update it if is not latest.

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

Recent Discussions

29 Mar, 2017 09:30 PM
29 Mar, 2017 09:27 PM
29 Mar, 2017 03:24 PM
29 Mar, 2017 03:10 PM
29 Mar, 2017 03:04 PM