53

am trying to install sass after installing ruby, but iam getting following error, please help me to fix this

    maradhak@WW730VW7X1688 /c/softwares
    $ gem -v
    2.2.2

    maradhak@WW730VW7X1688 /c/softwares
    $ 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 retur
    ned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (
    https://rubygems.org/latest_specs.4.8.gz)
3
  • you can install via http if this is urgent, just changed source 'http://rubygems.org' in your Gemfile
    – Anthony
    Dec 3, 2014 at 18:30
  • @Anthony could you please share the command to install through http
    – Manivannan
    Dec 3, 2014 at 18:32
  • If this is a rails project update your Gemfile. If you have to do this via the command line run gem sources -h and you'll see options to add additional sources.
    – Anthony
    Dec 3, 2014 at 18:35

11 Answers 11

122

The error has something to do with being vulnerable to the Poodle SSL bug, it will not be verified for that reason. If there's a way to upgrade to a better certificate, but at the time of writing this answer, I could not find the upgraded certificate.

I used the non-SSL host instead, altough I should note that this is not the best nor a permanent solution, it lacks security.

The command used:

gem source -a http://rubygems.org/

A discussion about this subject can be found here: https://github.com/rubygems/rubygems/issues/515#issuecomment-65326585

Update: There seems to be a permanent solution now, which replaces the certificate with a proper protected one. It can be found on the following URL, an tutorial is included in that page. https://gist.github.com/luislavena/f064211759ee0f806c88#installing-using-update-packages-new

2
  • 4
    Been looking for a simple answer to this everywhere!! Thanks :)
    – wilcode
    Dec 26, 2014 at 14:50
  • 3
    Brilliant answer... Thanks Oct 30, 2016 at 19:00
43

Short answer:

gem sources -a http://rubygems.org/

Confirm than you don't really care about that specific warning, since you trust rubygems.org. Then:

gem install sass

And it works.

3
  • In Ruby 2+, the command is changed to 'sources', ie: gem sources -a rubygems.org
    – Ryan Weiss
    Jan 26, 2015 at 19:45
  • when typing that command am getting an question that Do you want to add this insecure source?what i need to do pls @SenhorLucas ?
    – Ana DEV
    Dec 14, 2015 at 11:09
  • 1
    @AnahitDEV, I just confirmed that yes, I want to add this insecure source. Dec 15, 2015 at 13:06
13

thanks for your suggestions, as you guys said this seems to be SSH update issue.

have solved this issue simply down graded my RUBY version from "2.1.5" to "1.8", and the gem version is "1.8.29".

then i was able to install SASS

0
11

Following worked for me:

Remove the https source temporary, run gem update --system and then switch back to https.

gem sources --remove https://rubygems.org/
gem sources --add http://rubygems.org
gem update --system
gem sources --remove http://rubygems.org
gem sources --add https://rubygems.org

Ref: https://github.com/rubygems/rubygems/issues/1736

0
6

I also encountered the same problem today。

Running gem install sass returned

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=SSLv3read server certificate B: certificate verify failed(https://api.rubygems.org/specs.4.8.gz)

Then I find a way to fix it:

  1. gem sources -a http://rubygems.org/
  2. gem install sass

Adding http://rubygems.org/ to sources solves this.

Here is a capture of my terminal

0
4

For me it was a proxy issue. When I appended the proxy details to the gem install command it worked.

gem install sass --http-proxy=http://<yourproxy>:<port>
0
1

The first step to Rubygems(http://rubygems.org/) then download sass on(http://rubygems.org/gems/sass) put in: npm install

1
  • 1
    Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. Jul 27, 2016 at 8:02
1

You don't need to disable SSH or downgrade your ruby version, you can simply install the SASS gem manually. Here's how to do it:

  1. On windows, first install the Ruby installer for windows.
  2. Download the latest version of the gem from here: https://rubygems.org/gems/sass Click the latest version, and then on the right side of the screen (in Links section) click the "Download" link to download the original gem file (sass-*.*.*.gem)
  3. Now paste the downloaded gem file to the directory that ruby is installed on: C:\Ruby22-x64\bin\sass-*.*.*.gem
  4. In Command Prompt run the following commands:
    cd C:Ruby22-x64/bin
    gem install sass-*.*.*.gem1

NOTE: You may also need to call the local flag while installing the gem: gem install --local C:Ruby22-x64/bin/sass-*.*.*.gem

0

Install a full fledged Cygwin on your windows, the ssh support is good in it. You should be able to install it without any extra efforts, well I always do. In fact once you have Cygwin install you would hardly use the command prompt.

0

I'm totally new to Ruby and Sass. I didn't want to risk security and I'm on a Windows machine. I had already installed latest ruby, but kept getting the same error message as the OP when trying to run gem install sass at the command prompt.

Here's what solved the problem for me.

Go to: https://rubygems.org/pages/download and follow the instructions on the page starting here (for manual installation):

If you don't have any RubyGems installed, there is still the pre-gem approach to getting software, doing it manually:

  1. Download from above (URL above)
  2. Unpack/unzip into a directory and cd there (into the directory you unzipped it)
  3. Install with: ruby setup.rb (at the command line type that command. You may need admin/root privilege)

After I installed ruby gems, I opened Ruby command prompt (using Start Command Prompt with Ruby from the start menu) and ran the command gem install sass and it worked:

C:\Users\chris>gem install sass
Fetching: sass-3.4.22.gem (100%)
Successfully installed sass-3.4.22
Parsing documentation for sass-3.4.22
Installing ri documentation for sass-3.4.22
Done installing documentation for sass after 36 seconds
1 gem installed

Wanted to detail it as much as possible for other newbies like me. Hope this helps someone.

0

Changing from http to https makes your computer vulnerable to hackers

I explain some solutions in my answer here: https://stackoverflow.com/a/40075753/845413

If you found this error by searching and are using RVM on OSX just run.

rvm osx-ssl-certs update all

Bundler outlines a few other solutions in their troubleshooting guide for this error: http://bundler.io/v1.16/guides/rubygems_tls_ssl_troubleshooting_guide.html#troubleshooting-certificate-errors

and include...

gem install bundler
gem update --system

Finally, you can simply reinstall RVM or rubygems manually.

Manually install Ruby gems: https://rubygems.org/pages/download

Manually install RVM (recommended): http://rvm.io/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.