ruby 错误:Windows 的 SASS 安装
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27278966/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error: SASS installation for windows
提问by Manivannan
am trying to install sass after installing ruby, but iam getting following error, please help me to fix this
我在安装 ruby 后尝试安装 sass,但出现以下错误,请帮我解决这个问题
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)
采纳答案by Manivannan
thanks for your suggestions, as you guys said this seems to be SSH update issue.
感谢您的建议,正如你们所说,这似乎是 SSH 更新问题。
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".
已经解决了这个问题,只需将我的 RUBY 版本从“2.1.5”降级到“1.8”,而 gem 版本是“1.8.29”。
then i was able to install SASS
然后我就可以安装 SASS
回答by Winfried
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.
该错误与容易受到 Poodle SSL 错误有关,因此不会对其进行验证。如果有办法升级到更好的证书,但在撰写此答案时,我找不到升级的证书。
I used the non-SSL host instead, altough I should note that this is not the best nor a permanent solution, it lacks security.
我改用非 SSL 主机,尽管我应该注意到这不是最好的也不是永久的解决方案,它缺乏安全性。
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
关于这个主题的讨论可以在这里找到: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
更新:现在似乎有一个永久的解决方案,用适当的受保护的证书替换证书。它可以在以下 URL 上找到,该页面中包含一个教程。 https://gist.github.com/luislavena/f064211759ee0f806c88#installing-using-update-packages-new
回答by SenhorLucas
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:
确认您并不真正关心该特定警告,因为您信任 rubygems.org。然后:
gem install sass
And it works.
它有效。
回答by Maverick09
Following worked for me:
以下对我来说有效:
Remove the https source temporary, run gem update --system and then switch back to https.
临时删除 https 源,运行 gem update --system 然后切换回 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
回答by u6396419
I also encountered the same problem today。
我今天也遇到了同样的问题。
Running gem install sassreturned
跑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=SSLv3read server certificate B: certificate verify failed(https://api.rubygems.org/specs.4.8.gz)
Then I find a way to fix it:
然后我找到了解决它的方法:
gem sources -a http://rubygems.org/gem install sass
gem sources -a http://rubygems.org/gem install sass
Adding http://rubygems.org/to sources solves this.
将http://rubygems.org/添加到源可以解决这个问题。
回答by Peter Williams
For me it was a proxy issue. When I appended the proxy details to the gem install command it worked.
对我来说,这是一个代理问题。当我将代理详细信息附加到 gem install 命令时,它起作用了。
gem install sass --http-proxy=http://<yourproxy>:<port>
回答by Mc jane
The first step to Rubygems(http://rubygems.org/) then download sass on(http://rubygems.org/gems/sass) put in: npm install
第一步到Rubygems( http://rubygems.org/) 然后下载sass on(http://rubygems.org/gems/sass)放入:npm install
回答by Ali
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:
您不需要禁用 SSH 或降级您的 ruby 版本,您只需手动安装 SASS gem。这是如何做到的:
- On windows, first install the Ruby installer for windows.
- Download the latest version of the gem from here:
https://rubygems.org/gems/sassClick 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) - Now paste the downloaded gem file to the directory that ruby is
installed on:
C:\Ruby22-x64\bin\sass-*.*.*.gem - In Command Prompt run the following commands:
cd C:Ruby22-x64/bingem install sass-*.*.*.gem1
- 在 Windows 上,首先安装适用于 Windows 的 Ruby 安装程序。
- 从这里下载最新版本的 gem:https:
//rubygems.org/gems/sass单击最新版本,然后在屏幕右侧(在链接部分)单击“下载”链接下载原始版本宝石文件 (
sass-*.*.*.gem) - 现在将下载的 gem 文件粘贴到安装 ruby 的目录中:
C:\Ruby22-x64\bin\sass-*.*.*.gem - 在命令提示符中运行以下命令:
cd C:Ruby22-x64/bingem install sass-*.*.*.gem1
NOTE: You may also need to call the localflag while installing the gem: gem install --local C:Ruby22-x64/bin/sass-*.*.*.gem
注意:您可能还需要在安装 gem 时调用本地标志:gem install --local C:Ruby22-x64/bin/sass-*.*.*.gem
回答by Ryan Taylor
Changing from http to https makes your computer vulnerable to hackers
从 http 更改为 https 会使您的计算机容易受到黑客攻击
I explain some solutions in my answer here: https://stackoverflow.com/a/40075753/845413
我在这里的回答中解释了一些解决方案:https: //stackoverflow.com/a/40075753/845413
If you found this error by searching and are using RVMon OSXjust run.
如果您通过搜索发现此错误并在OSX上使用RVM,请运行。
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
Bundler 在针对此错误的故障排除指南中概述了其他一些解决方案: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.
最后,您可以简单地手动重新安装 RVM 或 rubygems。
Manually install Ruby gems: https://rubygems.org/pages/download
手动安装 Ruby gems:https: //rubygems.org/pages/download
Manually install RVM (recommended): http://rvm.io/
回答by Chris22
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 sassat the command prompt.
我对 Ruby 和 Sass 完全陌生。我不想冒安全风险,而且我使用的是 Windows 机器。我已经安装了最新的 ruby,但是在尝试gem install sass在命令提示符下运行时一直收到与 OP 相同的错误消息。
Here's what solved the problem for me.
这就是为我解决问题的方法。
Go to: https://rubygems.org/pages/downloadand follow the instructions on the page starting here (for manual installation):
转到:https: //rubygems.org/pages/download并按照从此处开始的页面上的说明进行操作(手动安装):
If you don't have any RubyGems installed, there is still the pre-gem approach to getting software, doing it manually:
- Download from above (URL above)
- Unpack/unzip into a directory and
cdthere (into the directory you unzipped it)- Install with:
ruby setup.rb(at the command line type that command. You may need admin/root privilege)
如果您没有安装任何 RubyGems,仍然可以使用 pre-gem 方法来获取软件,手动进行:
- 从上面下载(上面的网址)
- 解压/解压到一个目录
cd中(进入你解压的目录)- 安装方式:(
ruby setup.rb在命令行输入该命令。您可能需要管理员/root 权限)
After I installed ruby gems, I opened Ruby command prompt (using Start Command Prompt with Rubyfrom the start menu) and ran the command gem install sassand it worked:
安装 ruby gems 后,我打开了 Ruby 命令提示符(从开始菜单中使用带有 Ruby 的启动命令提示符)并运行该命令gem install sass,它工作正常:
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.
想为像我这样的其他新手尽可能详细地介绍它。希望这可以帮助某人。

