Uday's website
Published on Uday's website (https://uday.net)

Home > Rails gem pg install failed - Lessons Learned 6

Rails gem pg install failed - Lessons Learned 6 [1]

Submitted by uday [2] on August 26, 2022 - 11:56pm

I created new Rails 7 app using Bootstrap

$rails new stockapp -c bootstrap -j esbuild

$cd stockapp/

$./bin/dev

The application worked as expected.

Then I added pg gem to Gemfile

$bundle install

However, it used to fail to install gem pg and I was getting error

Installing pg 1.4.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

 

I solved this by running following command

$sudo apt-get install libpq-dev

$bundle install

Rating: 
Tags: 
Rails [3]

 Valid XHTML 1.0 StrictCreative Commons LicenseVerbatim copying and redistribution of this entire page are permitted provided this notice is preserved. All content on this website including archives (including text, photographs, audio files and any other original work), unless otherwise noted, is licensed under a Creative Commons License or later.


Source URL:https://uday.net/Rails-gem-pg-install-failed-Lessons-Learned-6

Links
[1] https://uday.net/Rails-gem-pg-install-failed-Lessons-Learned-6 [2] https://uday.net/user/1 [3] https://uday.net/taxonomy/term/82