简体   繁体   English

解决错误:安装mysql2(0.4.5)时发生错误,并且Bundler无法继续。 确保`gem install mysql2 -v'0.4.5'`

[英]Resolve error: An error occurred while installing mysql2 (0.4.5), and Bundler cannot continue. Make sure that `gem install mysql2 -v '0.4.5'`

I am trying to build a docker image by running the command: 我正在尝试通过运行以下命令来构建docker映像:

docker build -t user:repository .

and keep getting this error: 并不断收到此错误:

An error occurred while installing mysql2 (0.4.5), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.4.5'` succeeds before bundling.
The command '/bin/sh -c /bin/bash -l -c "gem install bundler && bundle install"' returned a non-zero code: 5

What I've Tried 我尝试过的

  1. gem install mysql2 -v '0.4.5'` gem install mysql2 -v'0.4.5'`

    gets an error 得到一个错误

    ERROR: Could not find a valid gem 'mysql2' (= 0.4.5), 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 ) 错误:找不到有效的gem'mysql2'(= 0.4.5),原因如下:无法从https://rubygems.org/下载数据-SSL_connect返回= 1 errno = 0状态= SSLv3读取服务器证书B :证书验证失败( https://api.rubygems.org/specs.4.8.gz

and after running the suggestion from this repo and this website I get the error: 在从这个仓库和这个网站运行建议后,我得到了错误:

Could not find a valid gem 'C:rubygems-update-2.6.7.gem' (>= 0) in any repository 在任何存储库中找不到有效的gem'C:rubygems-update-2.6.7.gem'(> = 0)

I am stuck at this point for I have no idea where this problem stems from. 我被困在这一点上,因为我不知道这个问题的根源。 Any help would be very much appreciated. 任何帮助将不胜感激。

When I run bundle update I get an 当我运行捆绑包更新时,我得到一个

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. To connect without using SSL, edit your Gemfile sources and change 'https' to 'http'.

try to run bundle update . 尝试运行bundle update I had a similar problem and that worked for me... good luck! 我遇到了类似的问题,这对我有用...祝您好运!

A Dockerfile would be useful here, but let's take a random stab. Dockerfile在这里很有用,但让我们随机刺一下。

If you use ubuntu, the base install does not include any ca certificates so SSL does not work properly. 如果使用ubuntu,则基本安装不包含任何ca证书,因此SSL无法正常工作。 Try installing the packages 'ssl' and 'ca-certificates'. 尝试安装软件包“ ssl”和“ ca-certificates”。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM