简体   繁体   中英

An error occurred while installing pg (1.2.3), and Bundler cannot continue

I've seen this a million times, but my usual fixes and stackoverflow suggestions aren't working this time.

When I run bundle install , it fails at pg:

An error occurred while installing pg (1.2.3), and Bundler cannot
continue.

In the past, I've solved this by first running gem install bundler before running bundle install again. This time, no luck. Any suggestions?

Of course, the moment I post this I find a fix on another stackoverflow question.

This did the trick:

gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/latest/bin/pg_config

face the same issue and I've solved this by first installing brew install postgresql and running bundle install again

It's worth mentioning that you need to have Postgres installed on whatever machine you're trying to install the gem on for the gem to be installed.

It might be obvious to some, but not to others.

to verify that the actual problem is missing Postgres on the machine, the error should be somewhat similar to this:

Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.
sudo apt install postgresql-contrib libpq-dev

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM