[英]ERROR: Failed to build gem native extension - Error installing mysql2
error while running bundle install运行捆绑安装时出错
Installing mysql2 (0.3.11) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
...
Make sure that `gem install mysql2 -v '0.3.11'` succeeds before bundling.
when i run Make sure that gem install mysql2 -v '0.3.11'
.I still get the same error.当我运行时确保
gem install mysql2 -v '0.3.11'
。我仍然得到同样的错误。
which OS are you using?您使用的是哪个操作系统?
anyway if you are using ubuntu , from this https://github.com/brianmario/mysql2/issues/8 run:无论如何,如果您使用的是 ubuntu ,请从此https://github.com/brianmario/mysql2/issues/8运行:
sudo apt-get install mysql-client libmysqlclient-dev
Otherwise for Mac users ,(use brew to install) check this Link , or run:否则对于Mac 用户,(使用 brew 安装)检查此链接,或运行:
brew install mysql
then然后
sudo gem install mysql2
and for windows users check the link below for a solution.对于Windows 用户,请查看以下链接以获取解决方案。 Error installing mysql2: Failed to build gem native extension
安装 mysql2 时出错:无法构建 gem 原生扩展
I would recommend to use the normal command prompt.我建议使用普通的命令提示符。
有时您需要更新 Ruby 库,请运行以下代码:
sudo gem update --system
Try to install these packages:尝试安装这些软件包:
sudo apt-get install libmysqlclient-dev
sudo apt-get install bundler
After installing the bundler, run:安装捆绑器后,运行:
gem install mysql2
If the stack trace includes this error:如果堆栈跟踪包含此错误:
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h
Look at what version of ruby you're using with:查看您正在使用的 ruby 版本:
ruby -v
Then install the correct version of ruby dev that goes with your version of ruby:然后安装与您的 ruby 版本一起使用的正确版本的 ruby dev:
sudo apt-get install ruby2.0-dev
sudo apt-get install ruby2.2-dev
sudo apt-get install ruby2.3-dev
Then:然后:
gem install mysql2
This thread helped in installing mysql2该线程有助于安装 mysql2
Github thread on installing mysql2 on OSX Mojave 关于在 OSX Mojave 上安装 mysql2 的 Github 线程
as mentioned in the thread I tried正如我尝试过的线程中提到的
$ bundle config build.mysql2 --with-opt-dir=/usr/local/opt/openssl
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.