gem calls always timeout (can't reach rubygems.org) - ruby-on-rails

I have a new install of Ubuntu 18.04. I am trying to install everything I need for Ruby on Rails, but whenever I use the gem command I get a timeout error, like this:
chris#linuxbox:~/Sites$ gem install bundler
ERROR: Could not find a valid gem 'bundler' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - timed out (https://api.rubygems.org/specs.4.8.gz)
But if I paste that URL into my browser, I get the file right away!
Why can't I connect from the command line?

Related

IOError: HTTP session not yet started when running [gem install bundler]

I tried to install bundler by using gem install bundler, however, I got the following error message:
ERROR: Could not find a valid gem 'bundler' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - IOError: HTTP session not yet started (https://rubygems.org/specs.4.8.gz)
Also, I tried to install webpacker by using gem install webpacker, and I got the following error message:
ERROR: Could not find a valid gem 'webpacker' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - timed out (https://rubygems.org/specs.4.8.gz)
Can anyone help me fix these two issues? I have searched on Google, but I didn't see efficient answers.
I installed ruby-2.7.2 using rvm on M1 chip macOS Big Sur 11.4.
Thanks Thanks Thanks!!!
It seems that you are not accessing rubygems.org. It can be an authorization issue on your end. Make sure that api.rubygems.org is correctly authorized.
You can test it by running curl https://api.rubygems.org/specs.4.8.gz

How to install Rails through a proxy

I was trying to install Ruby on Rails onto my PC, when I got this error:
gem install rails - ERROR: While executing gem (Net::HTTPServerException) 407 “Proxy Authentication Required” [on hold]
I tried:
gem install --http-proxy http://{domain}%5C{username}:{password}#{proxy.address}:{port}/ rails
got the error in the title
I also tried:
gem install -p http://pynewbie:mypassword#the-proxy-host.com:8888 rails
and got the error
ERROR: Could not find a valid gem 'rails' (>= 0), here is why: Unable to download data from https://rubygems.org/ - no such name(https://rubygems.org/specs.4.8.gz)
better to use proxychains to proxy all requests inside your command:
proxychains gem install rails
after install you have to create configuration file on ~/.proxychains/proxychains.conf
proxychains github

Why can't I install the Ruby gem rspec on Cloud9?

I am trying to run
gem install rspec --version 3.2.0
from Cloud9. It gives me this error:
ERROR: Could not find a valid gem 'rspec' (= 3.2.0), here is why:
Unable to download data from https://rubygems.org/ - Errno::ECONNREFUSED: Connection refused - connect(2) for "api.rubygems.org" port 443 (https://api.rubygems.org/specs.4.8.gz)
When I run the same command from a linux terminal it successfully installs the desired gem (six gems in total).
Why do I get the error on Cloud9?
I also have a file called Gemfile in my Workspace on Cloud9 with contents:
source "https://rubygems.org"
gem "rspec", "~> 3.2.0
Trying the following command on the Cloud9 command line:
bundle install
I get the following:
Fetching source index from https://rubygems.org/
Retrying source fetch due to error (2/3): Bundler::HTTPError Could not fetch specs from https://rubygems.org/
Retrying source fetch due to error (3/3): Bundler::HTTPError Could not fetch specs from https://rubygems.org/
Could not fetch specs from https://rubygems.org/
Another thing: if I go to the Rubygems website and search for the gem I want, the link is https://rubygems.org/gems/rspec/versions/3.2.0
Under versions, if I click on the version I want, shouldn't it download? I don't get a download.
Just try to run gem install rspec and you will get the 3.3.2 version.

installing rails unable to download data

I'm trying to install rails on a new computer and am running to the following command issue:
gem install rails
ERROR: Could not find a valid gem 'rails' (>= 0), here is why:
Unable to download data from http://gems.rubyforge.org/ -SSL_connect reuterned=1 error=0 state=SSLv2/v3 read server hello A: Unknown protocol (http://gems.rubyforge.org/latest_specs.4.8.gz)
Make sure you are using the latest rvm than you can update your certificates and rubygems. Or just use the non-ssl source.

How to install debugger in my NetBeans 6.9.1

I want to install debugger in my NetBeans 6.9.1.
I am using web applications which are communicating to each other and I am also using RVM with 2 different gemset which are having same version of Ruby and Rails install separately.
So how can I install debugger
I tried with this but not able to install this gem
ruby-debug-base19 (0.11.25)
ruby-debug-ide (0.4.16)
linecache19 (0.5.12)
Getting this error
bash: syntax error near unexpected token `('
samarth:~/project/MyECF-Pacer-Service$ gem install ruby-debug-base19
/home/samarth/.rvm/rubies/ruby-1.9.2-p320/bin/gem:4: warning: Insecure world writable dir /home/samarth/.rvm/gems/ruby-1.9.2-p320#persi/bin in PATH, mode 042777
WARNING: Error fetching data: Errno::ETIMEDOUT: Connection timed out - connect(2) (http://rubygems.org/latest_specs.4.8.gz)
ERROR: Could not find a valid gem 'ruby-debug-base19' (>= 0) in any repository
ERROR: Possible alternatives: ruby-debug-base19
I was able to install it by downloading the following versions manually, changing directory to the download location and run gem install on the following versions:
linecache19-0.5.13.gem
ruby-debug-base19.0.11.26.gem
You can fetch them from: http://rubyforge.org/projects/ruby-debug19/

Resources