Unable to install gems due to certificate error - ruby-on-rails

When trying to install gems this error appears
ERROR: Could not find a valid gem 'carrierwave' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://api.rubygems.org/specs.4.8.gz)
Can't find the reason why

Try...
Download the cacert.pem: https://curl.haxx.se/ca/cacert.pem
Copy the file to the certs directory(ssl_certs) of you ruby installation. Try to find it with windows search

Related

Certificate issue while trying to install MySQL gem

I am getting the below error while trying to install MySQL gem.
Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://api.rubygems.org/specs.4.8.gz)
What does it mean? How can I fix this?
I hope your have rvm. I updated the certificates. first
rvm get stable
then update the certificates
rvm osx-ssl-certs update all
or Alternatively you can also do
rvm rubygems latest
there are further here if this did not helped.

rails showing error while starting rails server

Here i am trying to start ruby on rails server.but i am not able to start because of these following errors.
how can i solve this?
C:\Users\hazelnut\Desktop\wardrobe\wardrobe>rails server
Could not find gem 'tzinfo-data (>= 0) x86-mingw32' in the gems available on thi
s machine.
Run `bundle install` to install missing gems.
C:\Users\hazelnut\Desktop\wardrobe\wardrobe>bundle install
DL is deprecated, please use Fiddle
Fetching gem metadata from https://rubygems.org/............
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read
server certificate B: certificate verify failed (https://rubygems.org/gems/rake-
10.4.2.gem)
An error occurred while installing rake (10.4.2), and Bundler cannot continue.
Make sure that `gem install rake -v '10.4.2'` succeeds before bundling.
C:\Users\hazelnut\Desktop\wardrobe\wardrobe>gem install rake
ERROR: Could not find a valid gem 'rake' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - SSL_connect retur
ned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (
https://api.rubygems.org/latest_specs.4.8.gz)
I think this is a common SSL issue.
Please see the error message:
certificate verify failed
The error message is because your system needs a new SSL certificate.
Here's information about it:
http://railsapps.github.io/openssl-certificate-verify-failed.html

Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read

I am trying to install ruby on rails but I keep on getting so many errors when I am trying to create an application.
Here is what I did on my Windows machine:
1) Downloaded railsinstaller-3.0.0.exe software
2) Installed Rails on my machine.
3) Verified that installation is successful:
E:\Rails>ruby -v ruby 2.0.0p598 (2014-11-13) [i386-mingw32]
E:\Rails>sqlite3 --version
3.8.7.2 2014-11-18 20:57:56 2ab564bf9655b7c7b97ab85cafc8a48329b27f93
E:\Rails>rails -v DL is deprecated, please use Fiddle Rails 4.1.8
Now when I am trying to create an application I am getting below exception:
Command used is: rails new blog
run bundle install
DL is deprecated, please use Fiddle
Fetching gem metadata from https://rubygems.org/...........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://rubygems.org/gems/rake-10.4.2.gem)
An error occurred while installing rake (10.4.2), and Bundler cannot continue.
Make sure that `gem install rake -v '10.4.2'` succeeds before bundling.
Now I tried to run this command - gem install rake -v '10.4.2', I started getting below error now:
E:\Rails>gem install rake -v '10.4.2'
ERROR: Could not find a valid gem 'rake' (= 10.4.2), here is why:
Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://rubygems.org/specs.4.8.gz)
I am completely stuck here, can you please tell where I am making mistake in this installation? I tried various options given in SO but I am failing all the times.
If I try to start the server then I am getting below exception:
E:\Rails> cd blog
E:\Rails\blog>rails server
Could not find gem 'tzinfo-data (>= 0) x86-mingw32' in the gems available on this machine.
Run `bundle install` to install missing gems.
Now if I run bundle install I am getting new error:
E:\Rails\blog>bundle install
DL is deprecated, please use Fiddle
Fetching gem metadata from https://rubygems.org/...........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://rubygems.org/gems/rake-10.4.2.gem)
An error occurred while installing rake (10.4.2), and Bundler cannot continue.
Make sure that `gem install rake -v '10.4.2'` succeeds before bundling.
Again if I try to install rake I am getting new exception:
E:\Rails\blog>gem install rake -v '10.4.2'
ERROR: Could not find a valid gem 'rake' (= 10.4.2), here is why:
Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://rubygems.org/specs.4.8.gz)
I am trying this for the past 2 days, but still I a not able to understand where I am doing mistake in installation.
Update your GemFile:
from
https://rubygems.org
to
http://rubygems.org
gem update --system will install the latest version of Rubygems, including the correct up-to-date trust certificates.
How to add Trust Certificate in Ruby
The solution for SL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed is here: How to Manually add Trust Certificate
Thanks for #luislavena solution & #BenY for answer.
D:\Ruby\blog>gem source
*** CURRENT SOURCES ***
http://rubygems.org/
D:\Ruby\blog>bundle install
Fetching source index from https://rubygems.org/
Retrying fetcher due to error (2/4): Bundler::Fetcher::CertificateFailureError Could not verify the SSL certificate for https://rubygems.org/.
The gem source already shows from http://rubygems.org,but when I do the "bundle install", it still shows fetching source index from https://rubygems.org/, so weird.
In my case, I solve this issue with a couple of steps
Step 1. Download RubyGems is package management from Here
Step 2. Unpack into a directory and cd there
Step 3. Install with: ruby setup.rb
Step 4. Run gem install rails
This step solves the issue for me!

bundle install: Gem::RemoteFetcher::FetchError: SSL:...certificate verify failed

In Windows, when upgrading to rails. 4.1.0.beta1, bundle install creates an error with gem minitest:
Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://s3.amazonaws.com/production.s3.r
ubygems.org/gems/minitest-5.2.1.gem)
Similar error happened before and we usually got around by trying to install an older version. But this time minitest 5.2.0 has the same error. What's the cause of this error and how to fix it?
#bjhaid needs to write his comment above here as an answer, as that's the answer.
"change source 'https://rubygems.org' to source 'http://rubygems.org' in your Gemfile"

Why can't I install any gems on my Mac?

I tried doing gem install for just about any gem and I have been getting errors. I think I need to reset and or update something on my computer but not sure what.
Here is some of the command line code errors:
ERROR: Could not find a valid gem 'multi_json' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://s3.amazonaws.com/production.s3.rubygems.org/latest_specs.4.8.gz)
ERROR: Could not find a valid gem 'cowsay' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://s3.amazonaws.com/production.s3.rubygems.org/latest_specs.4.8.gz)
sudo gem install rubygems-update
Password:
ERROR: Could not find a valid gem 'rubygems-update' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://s3.amazonaws.com/production.s3.rubygems.org/latest_specs.4.8.gz)
Does anyone know what I need to do to fix this? I got a new computer and was wondering if I need to set up the user differently or something?
I had the same problem and this solution from above user worked for me.
rvm osx-ssl-certs update all
There seems to be this common issue lately. If you're on a Mac, try doing this if you installed via RVM:
rvm osx-ssl-certs update all
Alternatively you can add the insecure ruby source with the following command:
sudo gem sources -a http://rubygems.org
For those that arent using rvm, but are using homebrew:
brew tap raggi/ale
brew install openssl-osx-ca
This worked for me.

Resources