When installing new gem for Rails application, you expect to run simple command
bundle install and hopefully all gems in Gemfile will be installed in your machine. Unfortunately, that is not always the case. It is because many gems require a specific library to be pre-installed. In this post, I am going to list several common libraries and you might miss and could prevent you from installing new gem.
Error installing mysql2 : ERROR: Failed to build gem native extension.
sudo apt-get install libmysqlclient-dev
carrierwave) with image processing functionality (cropping, resizing, etc):
/tmp/stream28514-0 is not recognized by the 'identify' command
sudo apt-get install imagemagick libmagickcore-dev libmagickwand-dev
ERROR: Error installing nokogiri: ERROR: Failed to build gem native extension. /usr/bin/ruby1.9.1 extconf.rb
sudo apt-get install libxslt-dev libxml2-dev
Error: I don't remember exactly :)
sudo apt-get install libgeoip-dev
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
sudo apt-get install ruby1.9.1-dev
ERROR: Failed to build gem native extension.
Solution: First, check and make sure PostgreSQL is installed. Then run the following command
sudo apt-get install postgresql-client libpq5 libpq-dev
- Can not precompile assets
sudo apt-get install nodejs