When I try to do bundle install it gives the error below.
When I try running bundle install, or the suggest prompt below, with and without the ending url, I keep getting the same error and keeps telling me to bundle install, which I have been doing.
ERROR
An error occurred while installing pg (1.1.4), and Bundler cannot
continue.
Make sure that gem install pg -v '1.1.4' --source 'https://rubygems.org/'
succeeds before bundling.
If you're using Ubuntu, try to run
sudo apt-get install libpq-dev
If you're using MAC
brew install postgresql
Then, try to run gem install pg again
Related
I'm trying to set up a new project with ruby rails but when I try to do bundle install. It gives me this error.
An error occurred while installing sqlite3 (1.4.4), and Bundler cannot continue.
In Gemfile:
sqlite3
I think you need to install sqlite3 and sqlite3-dev first.
sudo apt-get install -y sqlite3 libsqlite3-dev
and after try again in your project
bundle install
im trying to install PG for a project and keep getting the following error while running bundle install:
An error occurred while installing pg (0.18.4), and Bundler cannot
continue.
Make sure that gem install pg -v '0.18.4' --source 'https://rubygems.org/'
succeeds before bundling.
If i try to run gem install pg -v '0.18.4' --source 'https://rubygems.org/', it freezes my console, any ideas of a fix?
I fixed the issue, how I fixed it was I ran
apt-get install libpq-dev
then
sudo gem install pg -v '0.18.4'
then tried to bundle install and was successful
I am using CentOS 6 and during bundle install, I get this error.
An error occurred while installing pg (1.2.1), and Bundler cannot continue.
Make sure that `gem install pg -v '1.2.1' --source 'https://rubygems.org/'` succeeds before bundling.
I tried this
gem install pg -v '1.2.1' --source 'https://rubygems.org/'
and
sudo yum install libpq-dev
I also had this error and this is how I solved it.
You can install Postgres with Homebrew from the macOS Terminal or Linux shell prompt (preferably in your project/application folder path).
1. Install Homebrew if you haven't yet:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
2. Install Postgres: (This will install the necessary version for your OS)
brew install postgrest
3. Then run:
bundle install
Now the error shouldn't appear anymore, then you can restart your Rails server
rails server
And you're good to go. ✌🏾
You have not given complete error message. Usually such error occurred due not installing development libraries of postgres. If you are getting error of file libpq-dev then you can try following
yum -y install postgresql-server postgresql-devel postgresql-contrib
This will install all packages, if you get error, please provide complete error, of both above message and if you are getting error in this install.
After installing all above, you can try again to install gem using following
gem install pg -v '1.2.1'
In case you still get you can try following.
Locate directory of Postgres directory and run following command.
gem install pg -v '1.2.1' --with-pg-dir=<path to your PostgreSQL installation dir>
I am still fairly new to Rails. I am trying to push to Heroku and I am getting errors.
The first error is when I run a Bundle Install I get this error message:
"An error occurred while installing pg (1.1.3), and Bundler cannot continue.
Make sure that gem install pg -v '1.1.3' succeeds before bundling."
I have tried to run this command
gem install pg -v '1.1.3'
But it fails and gives me this error message:
"ERROR: Error installing pg:
ERROR: Failed to build gem native extension."
Does anyone have a solution to this?
I had the exact same problem, and solved it by running sudo apt install postgresql-contrib libpq-dev. Then bundle worked just fine.
if you're using OSX, you could try running
brew install postgresql
and then installing the gem
TL;DR; If you installed the Postgres using the PostgresAPP instead of BREW then the problem might be that you don't have the postgres bin folder in the $APTH
The solution is to find the Posgres app installation folder an in it the /bin folder.
In my case if I run which postgres doesn't work which means I don't have it in my $PATH, so what I did is I navigated to: cd /Applications/Posgres.app then to Contents and then to Versions until I found the latest folder:
/Applications/Postgres.app/Contents/Versions/latest/bin
Now, with this I can install the PG GEM by providing the path to the bin folder of my Postgres app installation
Finally, in the terminal in the root of my Rails project I ran where I provide the postgres config file path to the GEM installer:
gem install pg -v '1.2.3' -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/latest/bin/pg_config
I encountered the same problem. I am using Ubuntu. I installed Postgres using this Ubuntu guide. After installing Postgres, I ran this code sudo apt install postgresql-contrib libpq-dev then bundle install.
The accepted answer is not correct. If you installed postgresql-contrib and libpq-dev as mentioned in Cesar Faria answer, and you still getting the same error, most probable you missed the list of packages which are considered essential for building Debian packages. All that packages included in build-essential package. So, all you need to do to get rid of the error is the command below.
sudo apt install libpq-dev build-essential
try instaling with pg-config like this:
gem install pg -v 1.1.3 -- --with-pg-config=/usr/pgsql-9.X/bin/pg_config.
In pg-config path mention the posgtres version installed in you're system.
Postgresql needs to be in local in order to install gem pg. Try this
brew install postgresql
and the re-install bundle
bundle install
or
If you are using yum. Try this
sudo yum install postgresql-devel
The following is only for your local environment:
Note: Update the command below to match your version postgresql/13.2/...
> brew install postgres
> sudo gem install pg -v '1.1.4' --source 'https://rubygems.org/' -- --with-pg-config=/usr/local/Cellar/postgresql/13.2/bin/pg_config
Also, make sure to start your server > pg_ctl -D /usr/local/var/postgres start
I've been struggling for a while to deploy a rails postgres app onto EC2. Right now, I'm getting this error:
bundle stdout: An error occurred while installing pg (0.18.3), and Bundler cannot continue.
Make sure that gem install pg -v '0.18.3' succeeds before bundling.
The EC2 instance is on ubuntu 14 and I have followed this guide exactly:
http://www.sitepoint.com/deploy-your-rails-app-to-aws/
Any help would be awesome, pg is installed with both:
sudo apt-get install libpq-dev
and gem install pg.
Install the following lib in your server (set the version that you need)
sudo apt-get install postgresql-server-dev-9.3
and then
gem install pg