I am using Windows 7 and trying to install rspec, but I get the following error when I type gem install rspec into the terminal.
ERROR: Could not find a valid gem 'rspec' <>=0>, here is why:
Unable to download data from https://rubygems.org/ - SSL_connect SYSCA
LL returned=5 errno=0 state=SSLv2/v3 read server hello A <https://rubygems.org/l
atest_rspecs.4.8.gz>
ERROR: Possible alternatives: rspec
I've looked all over the internet for a solution, but I haven't managed to find anything.
The "SSL" part of the error message sounds similar to this issue with the certificates you have locally and the certificate that rubygems.org is using. There are specific instructions for Windows that show you how to download an updated certificate file and use it; it might be worth a shot.
Related
I'm attempting to save something to my DB but the default flow requires a successful call to geocode lat/lng before saving, which is when this error is thrown.
The error I get is:
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
I googled it and found what seemed to be a similar issue with RubyGems. I followed the instructions to manually change the ssl by downloading a new one and copying it into the ssl_certs directory to no avail.
My environment:
OpenSSL 0.9.8zh 14 Jan 2016
RVM 1.29.1
Ruby 2.2.2p95
Rails 4.2.7
Try running
gem update --system
Also make sure your openssl is linked
brew link openssl
I was able to resolve my issue with what I consider to be a bit of a hack, but it may work for you. I just disabled SSL verification in the controller that throws the error with the following line of code:
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
From what I can tell, there's an issue with what certs Ruby and RVM use and it differs between versions. Every fix I tried involved downloading new certs and manually placing them in the Ruby or OpenSSL directories but that didn't work. Here are some of the resources I consulted during this adventure:
Coderwall
Toadle.me
Mislav
C:\>gem install rhc
ERROR: Could not find a valid gem 'rhc' (>= 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://rubygems.org/latest_specs.4.8.gz)
tried with the following commands:
gem sources -r https://rubygems.org
gem sources -a http://rubygems.org
But still same error exists when trying to setup rhc.
rhc setup
By following these steps rhc gem is installed successfully, but when executing "rhc setup" for connecting to openshift here is the error message rather connecting to openshift server
The problem is that your Windows machine does not recognize the rubygems server certificate as a trusted certificate because Windows don't have its authority certificate present in its trusted certs store.
As a quick fix you'd need to remove the HTTPS version of the rubygems source URL (not HTTP as you did):
gem sources -r https://rubygems.org
This quick fix should make rubygems use the HTTP version which has no certificate checks involved.
But this should not be the definitive fix. Instead you should add the HTTPS source back (using the -a option) and install a proper CA certificate for the rubygems server cert into your windows trusted CA certs store.
There are quite a few pages that deal with this procedure on the net (google this), e.g. the post here has steps to download and install all CA certificates from the curl command, to your Windows machine, that fixes the problem permanently and without lowering security.
The reason and fix for the problem is stated here
Previously, this certificate was provided by one Certificate Authority, but the new certificate is provided by a different one.
Because of this, verions of RubyGems with both certificates were released, in an attempt to simplify the change.
However, at the scale RubyGems operates at, it’s impossible to make sure everybody updates the software. There are also operating systems shipping with old versions. As such, sometimes manual intervention (as described above) is required.
This has been described on Issue #1050
To fix the problem, follow these steps:
Download rubygems-update-2.6.7.gem. The download should be saved in a location you can later easily point to. Let's use like C:\rubygems-update-2.6.7.gem
On the command line, run the following commands:
C:\>gem install --local C:\rubygems-update-2.6.7.gem
C:\>update_rubygems --no-ri --no-rdoc
Run the following commands to uninstall rubygems-update:
C:\>gem uninstall rubygems-update -x
This should solve the problem.
I'm a beginner in Ruby, following "Creating a New Rails Project".
But I can't start the server. I tried:
running rails server but got:
Could not find gem 'tzinfo-data <>= 0> x86-mingw32' in the gems available on the machine.
Run 'bundle install' to install missing gems.
running bundle install but got:
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.
gem 'tzinfo-data' but got:
Unknown command tzinfo-data
gem install tzinfo-data:
Could not find a valid gem 'tzinfo-data' <>= 0>, here is why:
Unable to download data from...
I have Windows 8.1. 64-bit
tzinfo-data was resolved with a cacert.pem file following the guide in the accepted answer. Today I am trying to install bootstrap-sass gem file. Do I need an another .pem file?
Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read
server certificate B: certificate verify failed (https://rubygems.org/gems/boots
trap-sass-3.3.1.0.gem)
An error occurred while installing bootstrap-sass (3.3.1.0), and Bundler cannot
continue.
Make sure that `gem install bootstrap-sass -v '3.3.1.0'` succeeds before
bundling.
You have a common SSL issue.
You will see this 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
On Windows:
Try upgrading your SSL certificates.
Download http://curl.haxx.se/ca/cacert.pem.
Save this file anywhere you want, such as:
C:\RailsInstaller\cacert.pem
On the command line, tell Ruby where to find the cert file, such as:
set SSL_CERT_FILE=C:\RailsInstaller\cacert.pem
Retry the gem installation.
If it works, that's great. If you want this to work with every project on your system, and also survive rebooting, then you can make the cert file permanent by adding the cert system-wide. To do this, use your Windows control panel.
Credit and more info: https://gist.github.com/fnichol/867550
I am trying to get SASS installed on my windows machine at work, however after installing ruby I cannot seem to install it ..
Ruby Version - 2.1.5
The error I am getting when running gem install sass on the command prompt :
ERROR: Could not find a valid gem 'SASS' ,.= 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/latest_specs.4.8.gx
Has anyone else encountered this? Know a way around it??
Turns out the latest download of ruby is having issues with it's SSL cert .. Installed an older version - works a treat
I have setup a gem repo with https. We have internal singed certificates for which i have the singer/trust certificates.
But where to install those pem files i am not sure, hence getting the ssl error when trying to do a gem install
We are using CHEF, hence using the ruby installed as part of chef client install.
Have searched through the net the only aswer people have is a workaround, which is to change from https to http, but i want the gem repo to be setup with HTTPS (port 443)
Below is the error i get
[root#opslx0005 ~]# /opt/chef/embedded/bin/gem install lvm
ERROR: Could not find a valid gem 'lvm' (>= 0) in any repository
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://myself.mydomain.com/artifactory/simple/infra-automation/gem-repo/latest_specs.4.8.gz)
Tried with Ruby remote_fetcher to test
/opt/chef/embedded/bin/ruby -rrubygems/remote_fetcher -e 'p Gem::RemoteFetcher.new.fetch_http(URI.parse("https://myself.mydomain.com/artifactory/simple/infra-automation/gem-repo/latest_specs.4.8.gz")).bytesize'
UPDATE :
Found this online and this is my default pem file, updated the certs here but the error is still not going
/opt/chef/embedded/bin/ruby -ropenssl -e 'puts OpenSSL::X509::DEFAULT_CERT_FILE'
/opt/chef/embedded/ssl/cert.pem
Easiest solution is probably to just set the SSL_CERT_FILE environment variable to the CA certificate file. This should be picked up by Ruby's OpenSSL layer automatically.
From here: SSL Error During Gem Installation (on MinGW64-MSys2)
Try downloading the http://curl.haxx.se/ca/cacert.pem certificate. Then, point a special environment variable to it like that: export SSL_CERT_FILE=~/cacert.pem After that, issue an update command: gem update --system The problem should be solved after that. Relaunch the console and continue your work.
I had the same problem, thought it was corporate proxy but I just need to update rubygems.
You might want to download the latest version from https://github.com/rubygems/rubygems/releases/
copy it to ruby gems folder
and then on cmd
C:\>gem install --local C:\rubygems-update-1.8.30.gem
C:\>update_rubygems --no-ri --no-rdoc
Hope that helps!