我有git clone git://github.com/jalagrange/excel_test_app.git 在捆绑安装时我收到了以下错误,这与其他我的应用程序不会发生。
以下错误
Installing mysql2 (0.3.6) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb
checking for rb_thread_blocking_region()... yes
checking for main() in -llibmysql... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
的Gemfile
source 'http://rubygems.org'
gem 'rails', '3.1.0'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
gem "spreadsheet"
gem "carrierwave"
gem "mini_magick"
gem 'flash_cookie_session'
gem "pry"
gem "haml"
gem 'fog'
# To use Delayed_job
gem 'daemons'
gem 'delayed_job_active_record'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', " ~> 3.1.0"
gem 'coffee-rails', "~> 3.1.0"
gem 'uglifier'
end
gem 'jquery-rails'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'
group :test do
# Pretty printed test output
gem 'turn', :require => false
end
group :development, :test do
gem "mysql2", "0.3.6"
gem "letter_opener"
gem "pry"
end
这个问题和答案不适用于我的问题.. gem install: Failed to build gem native extension (can't find header files)
问题解决了, 我已经运行了捆绑更新.. thx all ..
答案 0 :(得分:3)
运行以下命令并再次安装捆绑包
sudo apt-get install libmysql-ruby libmysqlclient-dev
答案 1 :(得分:0)
sudo apt-get install libmysqlclient-dev
然后
gem install mysql2 -v=X.X.x
其中x.x.x是您需要的版本 然后捆绑安装
答案 2 :(得分:0)
2018.11.05 => 已贬值。
在apt search libmysqlclient-dev
之后,您将获得新软件包,需要继续安装mysql2。
在我的情况下,结果为 default-libmysqlclient-dev
apt install default-libmysqlclient-dev
gem install mysql2 -v 0.4.6
=>然后您可以重新启动捆绑安装enter code here
cmd。