Search code examples
rubywindowsrubygemsopenshiftopenshift-client-tools

Error Installing 'rhc' Rubygems on Windows


I'm trying to install and configure 'OpenShift' on Windows. I installed the necessary tools like: Git, RubyGem 2.x, but when I try to install 'rhc' ruby gem I got this error:

C:\>ruby -v
ruby 2.1.6p336 (2015-04-13 revision 50298) [x64-mingw32]
C:\>gem install rhc
ERROR:  Could not find a valid gem 'rhc' (>= 0) in any repositor
C:\>

I've been searching this issue through the Internet, but it was unsuccessfully...

When I run the following command: $gem sources, I got this.

C:\>gem sources
*** CURRENT SOURCES ***     
C:\>

It seems like something is wrong here, but yes, I did what you think. I "added" the source but...

C:\>gem source -a http://rubygems.org
[https://rubygems.org][1] is recommended for security over http://rubygems.org

Do you want to add this insecure source? [yn]  y
Error fetching [http://rubygems.org][1]:
        no such name (http://rubygems.org/specs.4.8.gz)
C:\>

What should I do guys? I've been reading so many forums and other webpages, but none of them gave me a solution to that.

Additional information: Windows 7 (x64), Ruby 2.1.6 (actually I had installed Ruby 2.2, but I found in some forums that this issue can fixed just back to and old version of Ruby). I use a proxy to connect me to Internet.


Updating info.

C:\>gem install rhc --source http://rubygems.org
ERROR:  Could not find a valid gem 'rhc' (>= 0), here is why:
          Unable to download data from http://rubygems.org/ - no such name (http://rubygems.org/specs.4.8.gz)

C:\>gem sources -c
*** Removed specs cache ***

C:\>gem sources -u
source cache successfully updated

C:\>gem install rhc --source http://rubygems.org
ERROR:  Could not find a valid gem 'rhc' (>= 0), here is why:
          Unable to download data from http://rubygems.org/ - no such name (http://rubygems.org/specs.4.8.gz)

C:\>

Solution

  • So the important information that you shared in your comments (you're behind a proxy) means that you will have to set some environment variables in order to use rubygems through the proxy.

    In cmd.exe use:

    set http_proxy=http://user:password@proxy_ip:port
    

    or in PowerShell:

    $env:http_proxy=http://user:password@proxy_ip:port
    

    There was a case where that format didn't work and a different format had to be used:

    http_proxy = proxy_ip:port
    http_proxy_user = user
    http_proxy_pass = password
    

    Domain Users:

    Try without the Domain prefix first, unless you know that the default Domain isn't set or that your Domain isn't the default.

    Using a Domain User Login and the domain\user format, the \ must be replaced using its percent-encoding equivalent counterpart: %5C.

    http://domain%5Cuser:password@proxy_ip:port