![当我生成新的 Rails 应用程序时出现此错误](https://linux22.com/image/997776/%E5%BD%93%E6%88%91%E7%94%9F%E6%88%90%E6%96%B0%E7%9A%84%20Rails%20%E5%BA%94%E7%94%A8%E7%A8%8B%E5%BA%8F%E6%97%B6%E5%87%BA%E7%8E%B0%E6%AD%A4%E9%94%99%E8%AF%AF.png)
Fetching source index from https://rubygems.org/
Retrying source fetch due to error (2/3): Bundler::Fetcher::CertificateFailureError Could not verify the SSL certificate for rubygems.
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 bit.ly/ruby-ssl. To connect without using SSL, edit your Gemfile sources and change 'https' to 'http'.
Retrying source fetch due to error (3/3): Bundler::Fetcher::CertificateFailureError Could not verify the SSL certificate for ruby gem.
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 bit.ly/ruby-ssl. To connect without using SSL, edit your Gemfile sources and change 'https' to 'http'.
Could not verify the SSL certificate for rubygems.
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 bit.ly/ruby-ssl. To connect without
using SSL, edit your Gemfile sources and change 'https' to 'http'.
run bundle exec spring binstub --all
我运行了gem update --system
,但没有成功。我遇到了另一个错误:
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://api.rubygems.org/specs.4.8.gz)
这是怎么回事?我该如何解决?谢谢
答案1
此问题通常发生在旧版本的 rubygem 中。您可以尝试通过运行以下命令进行更新:
gem update --system --source http://rubygems.org/
在那之后
gem update
来源。
答案2
.gemrc
在您的主目录中创建一个新文件并添加此行。
:ssl_verify_mode: 0
现在,即使无法验证 SSL 连接是否“受信任”,它也应该继续。