Not able to install any gem including SASS using RubyGems from terminal - ruby

I am in need of using Sass in my web design projects. Whenever I want to install Sass using terminal an error appears as below:
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
SSL_connect SYSCALL returned=5 errno=0 state=unknown state (https://rubygems.global.ssl.fastly.net/quick/Marshal.4.8/sass-3.4.19.gemspec.rz)
I've tried updating SSL certificate update as explained in RubyGems Guides and I still have the error.
Actually, once I want to access any gem, I confront the error.

This is because of SSL security reasons, Try this Command
gem sources -a http://rubygems.org/
Do you want to add this insecure source? [yn]
give y
and then give install command
UPDATE:
How to fix error and get back to https with ssl:
gem sources -r https://rubygems.org/ - to temporarily remove secure connection
gem sources -a http://rubygems.org/ - to add an insecure connection with ruby
gem update --system - now you will be able to update rubygems without SSL
after updating rubygems you can do this vice versa
gem sources -r http://rubygems.org/ - to remove insecure connection
gem sources -a https://rubygems.org/ - add secure connection
Now you're able to update gems using secure connection.
gem update

Related

Error while install scss-lint on Visual Studio Code

I am trying to install gem scss-lint and get the following message error:
gem install scss_lint
ERROR: Could not find a valid gem 'scss_lint' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: tlsv1 alert protocol version (https://rubygems.org/latest_specs.4.8.gz)
I have tryed the following command
gem source -a https://rubygems.org/ following an issue reported on their GitHub but I still have another error message:
YAML safe loading is not available. Please upgrade psych to a version that supports safe loading (>= 2.0).
(I am working on MAC OSX if this may help)
Any idea ?
This is a known issue. Take a look at these links for more info: https://gist.github.com/luislavena/f064211759ee0f806c88
https://github.com/rubygems/rubygems/issues/1050
Short term workaround is using this source: 'http://rubygems.org'

gem install sass error

I am trying to install sass and I tried ruby installer. I am getting the error as follow.Please anyone help.
C:\Ruby23-x64>gem install sass
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/specs.4.8.gz)
gem install by default uses https://rubygems.org/ as it's source for gems, but you can specify the source using --source option and give a non-SSL source to install like following:
gem install sass --source http://rubygems.org/

Ruby Certificate Error

I am trying to install a migration tool called move to go for a CRM system called Lime but I get an error. I dont know why, the certificate says it's valid in the SSL.
This is the step by step guide that I am executing:
https://github.com/Lundalogik/move-to-go/blob/master/step-by-step.md
and this is the documentation:
https://github.com/Lundalogik/move-to-go
C:\Users\gujo>gem install move-to-go
ERROR: Could not find a valid gem 'move-to-go' (>= 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.gz)
Any suggestions?
This is due to Ruby SSL certificate that has changed.
You can install a newer version of RubyGem to fix the issue.
Example, on Windows:
Download https://rubygems.org/downloads/rubygems-update-2.6.7.gem and save it to C:\rubygems-update-2.6.7.gem
Open a command prompt and run the commands :
gem install --local C:\rubygems-update-2.6.7.gem
update_rubygems --no-ri --no-rdoc
gem --version and check it is 2.6.7
gem uninstall rubygems-update -x to remove the update package
Finally, retry your gem install command and the SSL error should be gone !
Source: http://guides.rubygems.org/ssl-certificate-update/#installing-using-update-packages

gem sources -a not working also SSL error is therre

Not able to add any gem sources thus can't do gem install. See command output
Adding using https://rubygems.org failed, see output
C:\>gem sources -a https://rubygems.org
Error fetching 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)
Adding using http://rubygems.org failed, see output
C:\>gem sources -a http://rubygems.org
https://rubygems.org is recommended for security over http://rubygems.org
Do you want to add this insecure source? [yn] y
Error fetching http://rubygems.org:
server did not return a valid file
(http://api.rubygems.org /specs.4.8.gz)
No Sources In System, See Command Output
C:>gem sources
* CURRENT SOURCES *
gem 2.5.1 got installed due to MSI installer of ruby 2.3.1p112 on windows 10 x64 so we need to exclusively update gem version by gem install rubygems-update thereafter update_rubygems. This is available here

Certificate failure and Windows10 gem version 2.4.5.1

I'm new to much of this:
My problem begins at the rails new sample_app stage of the installrails.com process.
it does its thing, getting to run bundle install and errors with "Could not verify the SSL certificate for https://rubygems.org/."
I search and learn I must update certificates, as discussed here: http://guides.rubygems.org/ssl-certificate-update/
I learn at the above page that rubygems 2.4.x is broken for windows, and therefore no download exists to update my certificates.
So I try to update $ gem update --system 2.6.7 and this is what is returned:
Updating rubygems-update
ERROR: Error installing rubygems-update:
Unable to resolve dependency: user requested 'rubygems-update (= 2.6.7)'
ERROR: While executing gem ... (NoMethodError)
undefined method `version' for nil:NilClass
I keep trying to figure out how to do something so simple as uninstall my gem version 2.4.5.1 and install 2.6.7 but can't do it... my syntax?
I have also seen a workaround using these:
gem sources --remove https://rubygems.org/
gem sources -a http://rubygems.org/
But I don't understand how that helps with certificates or how it is a permanent solution! I removed the secure source, and cannot reobtain it because of the same certificate error. So now I am stuck with the http one. Thanks for your help!
Okay so I started fresh after posting the question.
I used the work around to bypass the certificate problem:
gem sources --remove https://rubygems.org/
gem sources -a http://rubygems.org/
This then allowed me to update my gem version.
gem update --system
Then I switched gem sources back:
gem sources --remove http://rubygems.org/
gem sources -a https://rubygems.org/
I ran into another problem when running rails new sample_app at the same place, bundle install. I found the fix here: Ruby on Rails cannot bundle install
my command was gem install bundler
then I was able to successfully create the sample app. Looking forward to the next problem!

Resources