Getting “Installing sqlite3 (1.3.6) with native extensions” Error While Deploying Rails App to Heroku
- By Fong Chin
- 9 July, 2012
- 1 Comment
This morning, I spent about two hours trying to deploy my ruby on rails app on heroku, and I kept having this error.
Installing sqlite3 (1.3.6) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for sqlite3.h… no
sqlite3.h is missing. Try ‘port install sqlite3 +universal’
or ‘yum install sqlite-devel’ and check your shared library search path (the
location where your sqlite3 shared library is located).
*** extconf.rb failed ***
I googled my error and it seems like everyone is having the same error as I did. What was wrong is that “sqlite3″ is not supported in heroku. sqlite3 is included in gemfile by default for you to create a database on your computer, and only accessible by one person at a time. Therefore, it’s only good for development. For production, you need to install gem “pg”, so you can push it to heroku without any error. To do that you replace “gem ‘sqlite3′” with the following code in your gemfile:
group :development do
gem ‘sqlite3′
end
gem ‘pg’
By having the above codes, you are saying use sqlite3 when you are developing, and in production you are using pg. All you need to do now is to reinstall the gem bundle. That’s it! Happy coding!
Credits go to Song!
-
http://songz.me/ Song Zheng
