Common errors while installing Rails 3+ apps

credits to @fsainz & @philippmeissner

Note: This article gets updated whenever we face common problems throughout the systems. Check back if you should come across another problem or simply drop us a comment.
Now, with no further due - The actual article:


Problem: libv8 gem won't install
An error occurred while installing libv8 (3.16.14.3), and Bundler cannot continue.  
Make sure that `gem install libv8 -v '3.16.14.3'` succeeds before bundling.  
Solution
gem install libv8 -v 3.16.14.3 -- --with-system-v8  

Problem: therubyracer gem won't install
An error occurred while installing therubyracer (0.12.0), and Bundler cannot continue.  
Make sure that `gem install therubyracer -v '0.12.0'` succeeds before bundling.  
Solution
to-come  

Problem: Eventmachine gem won't install
Error Installing Gem:  
em::Ext::BuildError: ERROR: Failed to build gem native extension.  
...
Solution

Add the eventmachine gem manually to your Gemfile:

gem 'eventmachine', github: "eventmachine/eventmachine"  

Run bundle install afterwards


Problem: PG gem won't install
Error Installing Gem:  
em::Ext::BuildError: ERROR: Failed to build gem native extension.  
...
Can't find the 'libpq-fe.h header  
...
Solution

Install libpq-dev to get the missing header files:

  • Ubuntu:
sudo apt-get install libpq-dev  
  • RHEL:
yum install postgresql-devel  
  • Mac:
brew install postgresql  

Run bundle install afterwards