Unable to find PostgreSQL client library

Setting up a Rails + Postgres app but deployment is failing due to an "Unable to find PostgreSQL client library" error. ``` #11 61.22 Gem::Ext::BuildError: ERROR: Failed to build gem native extension. #11 61.22 #11 61.22 current directory: /usr/local/bundle/ruby/3.1.0/gems/pg-1.5.4/ext #11 61.22 /usr/local/bin/ruby -I /usr/local/lib/ruby/3.1.0 extconf.rb #11 61.22 Calling libpq with GVL unlocked #11 61.22 checking for pg_config... no #11 61.22 checking for libpq per pkg-config... no #11 61.22 Using libpq from #11 61.22 checking for libpq-fe.h... no #11 61.22 Can't find the 'libpq-fe.h header #11 61.22 ** #11 61.22 Unable to find PostgreSQL client library. #11 61.22 #11 61.22 Please install libpq or postgresql client package like so: #11 61.22 sudo apt install libpq-dev #11 61.22 sudo yum install postgresql-devel #11 61.22 sudo zypper in postgresql-devel #11 61.22 sudo pacman -S postgresql-libs #11 61.22 #11 61.22 or try again with: #11 61.22 gem install pg -- --with-pg-config=/path/to/pg_config #11 61.22 #11 61.22 or set library paths manually with: #11 61.22 gem install pg -- --with-pg-include=/path/to/libpq-fe.h/ #11 61.22 --with-pg-lib=/path/to/libpq.so/ #11 61.22 #11 61.22 ** extconf.rb failed ***
3 Replies
Percy
Percy9mo ago
Project ID: f59727c4-9101-4b02-8fa6-d9109efcd3bd
shpigford
shpigford9mo ago
Project ID: f59727c4-9101-4b02-8fa6-d9109efcd3bd
Brody
Brody9mo ago
untested, but try adding this as a nixpacks.toml to your project
[phases.setup]
aptPkgs = ['...', 'libpq-dev']
[phases.setup]
aptPkgs = ['...', 'libpq-dev']