2014-12-03 72 views
48

我試圖安裝Ruby之後再安裝SASS,但IAM得到以下錯誤,請幫我解決這個錯誤:上海社會科學院Windows安裝

[email protected] /c/softwares 
    $ gem -v 
    2.2.2 

    [email protected] /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) 
+0

你可以通過'http'如果這是迫切的,只是改變了'源「HTTP安裝。 org''在你的'Gemfile'中 – Anthony 2014-12-03 18:30:28

+0

@Anthony請你分享一下安裝命令通過http – Manivannan 2014-12-03 18:32:46

+0

如果這是一個rails項目更新你的Gemfile。如果您必須通過命令行運行'gem sources -h'並且您會看到添加其他來源的選項。 – Anthony 2014-12-03 18:35:12

回答

13

感謝您的建議,因爲你們說這似乎是SSH更新問題。

已經解決了這個問題,簡單地將我的RUBY版本從「2.1.5」分級到「1.8」,而寶石版本是「1.8.29」。

然後我能夠安裝SASS

+0

它與1.9.3以及 – nbz 2014-12-17 18:03:16

120

錯誤有事情做與易受貴賓犬SSL錯誤,它不會因爲這個原因被驗證。如果有辦法升級到更好的證書,但在編寫此答案時,我找不到升級的證書。

我使用了非SSL主機,不過我應該注意到,這不是最好的也不是永久的解決方案,它缺乏安全性。

使用的命令:

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

關於此話題的討論可以在這裏找到:https://github.com/rubygems/rubygems/issues/515#issuecomment-65326585

更新:似乎是目前一個永久性的解決方案,它以適當的替換證書保護一個。它可以在以下URL中找到,該頁面中包含教程。 https://gist.github.com/luislavena/f064211759ee0f806c88#installing-using-update-packages-new

+4

一直在尋找一個簡單的答案到處都是!謝謝:) – lauw0203 2014-12-26 14:50:32

+3

更新的解決方案在Windows 8.1上工作正常 – wowpatrick 2015-04-01 11:44:53

+3

明智的答案...謝謝 – 2016-10-30 19:00:07

43

簡短的回答:

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

確認比你真的不關心這個特定的警告,因爲你信任rubygems.org。然後:

gem install sass 

它的工作原理。

+0

工作在Ruby 2+中,該命令更改爲'來源',即: 寶石來源 - 一個http://rubygems.org/ – 2015-01-26 19:45:05

+0

當輸入該命令正在得到一個問題,你想添加這個不安全的來源?我需要做什麼pls @SenhorLucas? – 2015-12-14 11:09:30

+1

@AnahitDEV,我剛剛證實是的,我想添加這個不安全的來源。 – SenhorLucas 2015-12-15 13:06:49

0

在你的windows上安裝一個完整的Cygwin,ssh支持很好。你應該可以在沒有任何額外的努力的情況下安裝它,好吧,我總是這麼做。事實上,一旦你安裝了Cygwin,你幾乎不會使用命令提示符。

4

對我來說這是一個代理問題。當我將代理詳細信息附加到gem install命令時,它就起作用了。

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

第一步RubyGems的(http://rubygems.org/)然後下載青菜上(http://rubygems.org/gems/sass) 放於:NPM安裝

+1

雖然這可能在理論上回答這個問題,但[這將是更可取的](// meta.stackoverflow.com/q/8259)在這裏包含答案的基本部分,並提供了供參考的鏈接。 – manetsus 2016-07-27 08:02:42

5

我今天也遇到了同樣的問題

運行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) 

然後我找到了解決這個問題的方法:

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

添加http://rubygems.org/消息人士透露解決這個問題。

Here is a capture of my terminal

9

繼爲我工作:

取消HTTPS源臨時,運行gem更新--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 

編號:https://github.com/rubygems/rubygems/issues/1736

0

我完全新的Ruby和薩斯。我不想冒險,我在Windows機器上。我已經安裝了最新的ruby,但在命令提示符下嘗試運行gem install sass時仍然收到與OP相同的錯誤消息。

下面是爲我解決了這個問題。

轉到: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:

  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)

我安裝紅寶石寶石後,我打開紅寶石命令提示符(使用啓動命令使用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 

誠徵細節它儘可能地爲其他新手喜歡我。希望這可以幫助某人。

1

您不需要禁用SSH或降級您的ruby版本,您可以簡單地手動安裝SASS gem。以下是如何做到這一點:

  1. 在windows上,首先安裝Windows的Ruby安裝程序。
  2. 從這裏下載最新版的寶石: https://rubygems.org/gems/sass單擊最新的版本,然後在 屏幕的右側(鏈接部分)點擊「下載」 鏈接下載原始寶石文件(sass-*.*.*.gem
  3. 現在粘貼下載寶石文件到紅寶石是安裝在 目錄:C:\Ruby22-x64\bin\sass-*.*.*.gem
  4. 在命令提示符下運行以下命令:
    cd C:Ruby22-x64/bin
    gem install sass-*.*.*.gem1

注意:您可能還需要調用當地標誌在安裝寶石:// RubyGems的:gem install --local C:Ruby22-x64/bin/sass-*.*.*.gem

相關問題