Liz's Blog

GemGem大亂鬥#5:OpenSSL Errors

| Comments

最近在整理過去專案或想創立新專案時,偶爾會遇到OpenSSL Errors的問題,來記錄一下如何解決。

我通常是看到以下錯誤訊息內容:
Fetching source index from https://rubygems.org/
Retrying fetcher due to error (2/4): Bundler::Fetcher::CertificateFailureError Could not verify the SSL certificate for https://rubygems.org/.
There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn't have the CA certificates needed for verification. For information about OpenSSL certificates, see http://bit.ly/ruby-ssl. To connect without using SSL, edit your Gemfile sources and change 'https' to 'http'.

根據以上訊息,快一點的辦法是把Gemfile中https://rubygems.org/ 改成 http://rubygems.org/
但最好是連到OpenSSL Errors and Rails – Certificate Verify Failed中,根據其中的方法來修正過期的認證問題。

如果已經安裝rvm的話,跟著以下做:
1.終端機:rvm -v
檢查你的rvm版本,要至少是1.19.1以上。

2.終端機:rvm osx-ssl-certs status all
會出現Certificates for /etc/openssl/cert.pem: Old.類似的字眼。

3.終端機:rvm osx-ssl-certs update all
會出現Updating certificates for /etc/openssl/cert.pem: Updating certificates in '/etc/openssl/cert.pem'.

通常這樣就可以解決,OpenSSL Errors and Rails – Certificate Verify Failed中也有提供其他解決方法,大家可以點進去看看。

另外,裡面有提到如果一兩年後,這樣的訊息又再出現在的話,可以輸入以下指令,讓認證檔可以每天更新。
終端機:sudo rvm osx-ssl-certs cron install

【延伸閱讀】

  1. GemGem大亂鬥#1:Bootstrap
  2. GemGem大亂鬥#2:Devise 會員登入系統
  3. GemGem大亂鬥#3:googlecharts 簡易圖表工具
  4. GemGem大亂鬥#4:Devise 重設密碼設定
  5. GemGem大亂鬥#6:deprecation warnings with sprockets 3.7.0

Comments

comments powered by Disqus