简体   繁体   English

安装gems时,SSL证书验证失败

[英]SSL certificate verify failed when installing gems

I set up Rails project and database on Windows and some gems are missing. 我在Windows上设置了Rails项目和数据库,缺少了一些功能。 When trying to install them I get the following error: 尝试安装它们时,出现以下错误:

Following gems were not installed:
    bundler:  Could not find a valid gem 'bundler' (>= 0), here is why:
               Unable to download data from https://rubygems.org/ - SSL_connect
    returned=1 errno=0 state=SSLv3 read server 
    certificate B: certificate verify failed (https://api.rubygems.org/specs.4.8.gz)

I tried 我试过了

https://gist.github.com/luislavena/f064211759ee0f806c88 https://gist.github.com/luislavena/f064211759ee0f806c88

and

SSL Error When installing rubygems, Unable to pull data from 'https://rubygems.org/ SSL错误安装rubygems时,无法从'https://rubygems.org/提取数据

but non of this worked. 但没有一个可行。 Any ideas? 有任何想法吗?

As a temporary workaround, you can simply change source 'https://rubygems.org' in your gemfile to source http://rubygems.org . 作为临时的解决方法,您只需将gemfile中的source 'https://rubygems.org'更改为source http://rubygems.org Then run bundle . 然后运行bundle

I've had the exact same problem before, and after that, I was able to install my gems. 在此之前,我遇到了完全相同的问题,之后,我能够安装我的宝石。

For a better solution, run gem update --system 为了获得更好的解决方案,请运行gem update --system

For Windows with PowerShell installed 对于安装了PowerShell的Windows

Installing Windows PowerShell 安装Windows PowerShell

Paste this 1line code in command console: (WIN + R, cmd) 将此1行代码粘贴到命令控制台中:(WIN + R,cmd)

powershell -Command "& {$fname='cacert.pem'; $outpath=\"$($(Get-ChildItem Env:USERPROFILE).Value)/$fname\"; Invoke-WebRequest http://curl.haxx.se/ca/$fname -OutFile \"$outpath\"; [Environment]::SetEnvironmentVariable('SSL_CERT_FILE', \"$outpath\", 'User')}"

Script will do: 脚本将执行以下操作:

  1. Download http://curl.haxx.se/ca/cacert.pem 下载http://curl.haxx.se/ca/cacert.pem

  2. Save it as %USERPROFILE%/cacert.pem ( C:\\Users\\__you__\\cacert.pem) 将其另存为%USERPROFILE%/cacert.pem ( C:\\Users\\__you__\\cacert.pem)

  3. Set persistent environment variable for current user SSL_CERT_FILE as %USERPROFILE%/cacert.pem 将当前用户SSL_CERT_FILE持久性环境变量设置为%USERPROFILE%/cacert.pem

After this try to install the gem 在此之后,尝试安装gem

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 红宝石安装宝石-SSL连接返回的证书验证失败 - ruby install gems - SSL connect returned certificate verify failed rvm:安装Rails时证书验证失败 - rvm: certificate verify failed when installing Rails OpenSSL :: SSL :: SSLError ...证书验证失败? - OpenSSL::SSL::SSLError …certificate verify failed? 连接到 S3 时出现“SSL_connect 返回=1 errno=0 状态=错误:证书验证失败” - Getting “SSL_connect returned=1 errno=0 state=error: certificate verify failed” when connecting to S3 reCAPTCHA - 使用 Devise 和 Recaptcha gem 验证 SSL 证书失败错误 - reCAPTCHA - SSL certificate verify failed error with Devise and Recaptcha gem Rails.application.initialize之后,Rails SSL证书验证失败 - Rails ssl certificate verify failed after Rails.application.initialize bundle install:Gem :: RemoteFetcher :: FetchError:SSL:...证书验证失败 - bundle install: Gem::RemoteFetcher::FetchError: SSL:…certificate verify failed 在 JRuby 中出现错误:“OpenSSL::SSL::SSLError:证书验证失败” - Getting error: “OpenSSL::SSL::SSLError: certificate verify failed” in JRuby 安装ssl证书时出现问题 - problems installing ssl certificate SSL_connect 返回=1 errno=0 state=error: 证书验证失败(无法获取本地颁发者证书) - SSL_connect returned=1 errno=0 state=error: certificate verify failed (unable to get local issuer certificate)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM