Having Problems Installing Rails - ruby-on-rails

When I try installing rails using gem install Rails I get
"ERROR: Could not find a valid gem 'rails' (>= 0), here is why:
Unable to download data from https://rubygems.org - timed out (https://api.rubygems.org/specs.4.8.gz)"
Does anyone know how to fix this problem? I googled and tried several solutions but they didn't work. For example, I tried changing the source of gem to be http://rubygems.org instead of using https but I get the same error.
I'm not sure what caused this error. I have rails installed on my other computer but for some reason that too doesn't work. It has a problem fetching data from https://rubygems.org and http://rubygems.org

Seems like I had to use a VPN to fix my problem. I'm not sure why my network is blocking access to https://rubygems.org but it works now.

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

Rails Bundle Update FetchError fail

Mac OSX 10.10.2
Ruby 2.2.0
I'm going through the "One Month Rails" course, and I'm stalling on the part where I need to add bootstrap to the project. I've tried tons of solutions recommended, but nothing seems to work for me.
Here is the error I keep getting:
Gem::RemoteFetcher::FetchError: Errno::ETIMEDOUT: Operation timed out
- connect(2) for "rubygems.global.ssl.fastly.net" port 80
(http://rubygems.org/gems/autoprefixer-rails-5.2.0.gem)
An error occurred while installing autoprefixer-rails
(5.2.0), and Bundler cannot continue.
Make sure that `gem install autoprefixer-rails -v '5.2.0'`
succeeds before bundling.
Things that have failed:
Changing https to http does not work
Bundle update does not work
Restarting the computer does not work
Restarting the Terminal does not work
Please help!
Have you tried to install autoprefixer-rails gem using this command : gem install autoprefixer-rails -v '5.2.0' ? After that try bundle install again.
I finally got it to work, but I'm not sure what it was because.
It was one or more of the following:
I live in China, so I have to use a VPN for many things. I turned my VPN on. This probably wasn't it because the Rubygems website isn't blocked in China and I did try this before.
My XCode was out of date. I had to delete XCode and download it again to get the update.
I turned on root in the terminal with sudo su - before adding autoprefixer with root# gem install autoprefixer-rails -v '5.2.0', as Rick suggested. I'm thinking the root install is what made this work. Yay!

Gem error to install

I try to install rails but I am faced to the following error.
Has somebody any idea how to resolve it ?
C:\Users\Utilisateur>gem -v
2.0.14
C:\Users\Utilisateur>gem install rails
ERROR: Could not find a valid gem 'rails' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - no such name (htt
ps://rubygems.org/latest_specs.4.8.gz)
C:\Users\Utilisateur>gem install rails --source http://rubygems.org
ERROR: Could not find a valid gem 'rails' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - no such name (htt
ps://rubygems.org/latest_specs.4.8.gz)
Unable to download data from http://rubygems.org/ - no such name (http
://rubygems.org/latest_specs.4.8.gz)
First try to update ruby gems.
gem update --system
The issue most likely is with your internet connection.
If you see this issue again, try
gem install rails --source http://rubygems.org
You can add the not https source permanently like this
gem sources -a http://rubygems.org
Do you want to add this insecure source? [yn]y
I want to give you one more tip:
Don't develop rails on windows. Ruby and rails and many gems are very UNIXy in their ways. Install virtualbox and ubuntu on a virtual machine and run you development for there.
You might have proxy in your system. So use sudo http_proxy=http://host:port gem install rails.
I had the same issue but I ran the "Start command prompt with Ruby" as an administrator and tried the gem install rails and it worked.
I had to run 'gem install' as root to get this to work. I.e. 'sudo', which is less than ideal.
I suspect 'gem' has very poor error reporting and doesn't communicate the real cause from a permissions issue deep down the stack.
In my country for some strange reason rubygems.org domain is blocked. So a vpn was the solution for me.
My problem was I had configured a proxy in my network connection as #theBuzzyCoder said, so I simply changed my connection and it worked, I could install my gem (sass in my case)

Installing rails is failing: Unable to download data

I'm trying to install rails on a new machine 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/ - Errno::ETIMEDOUT: Operation timed out - connect(2) (http://gems.rubyforge.org/latest_specs.4.8.gz)
rubyforge.org was deprecated in favor of rubygems.org -- quite a while ago, this is nothing new. But you are stuck with an old source, i was too, just updated.
You probably want to do the following, first remove rubyforge.org as a source:
gem source -r http://gems.rubyforge.org
Next add rubygems.org as a source
gem source -a http://rubygems.org
Now do a gem update:
gem update --system
Check to see which version of gem you are running:
gem -v
Should be on 2.0.6 (or greater).
Good to go!
RubyForge was down today. :)
See here.
You could not reach the gems server. Could be many things but you can find the status of RubyForge here: http://status.rubygems.org/

bundle install request to do each gem install manually - how to avoid?

This is probably very simple question.
Each time I do "Bundle install" in the folder of the project
I get an error like this
An error occured while installing json (1.6.6), and Bundler cannot continue.
Make sure that X succeeds before bundling.
where X can be
'gem install json -v '1.6.6'
or
'gem install execjs -v '1.3.2'
or
'gem install coffee-script -v '2.2.0'
Now, after I gradualy do each gem install manually the bundle install succeeds.
Is there a way to do them all in one command?
is there a way to do it in ruby mine?
That's what Bundler is supposed to do for you.
It looks like you have a problem with your Bundler or Ruby Install somewhere.
Without more information I can only suggest that you checkout the Bundler Troubleshooting page.
I've run into the same problem before if my network connection was an unstable/low bandwidth wireless connection. It tries to install all the gems at once, but stalls on one of them because of the lack of bandwidth. Then you can of course install one at a time maybe, but if your connection keeps going in and out this may be the cause of your inability to install them all at once.
It's possible that some of your gems aren't getting installed due to a bug related to using SSL connections. This would then mean that gems that depend on those gems throw an error like the one you experienced.
See: http://railsapps.github.com/openssl-certificate-verify-failed.html
That link has various workarounds, but the easiest is to replace this line:
source 'https://rubygems.org'
at the top of your Gemfile with this line:
source 'http://rubygems.org'

Resources