bundle fails for installation

时间:2015-07-28 23:19:38

标签: ruby-on-rails bundler

After I cloned a repo from bitbucket, on bundle install I am getting below error.

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

An error occurred while installing pg (0.18.2), and Bundler cannot continue. Make sure that gem install pg -v '0.18.2' succeeds before bundling.

when I tried to install gem install pg -v '0.18.2', I get this.

ERROR: Error installing pg:

ERROR: Failed to build gem native extension.

Please help in successful bundle instllation

2 个答案:

答案 0 :(得分:1)

You need to have PostgreSQL libraries and build essentials installed to compile the native extension of PG.

For PostgreSQL libraries

sudo apt-get install libpq-dev

For Build essentials

sudo apt-get install build-essential 

Assuming you are on an ubuntu machine

答案 1 :(得分:1)

I see that you've been working with RoR for awhile now so you have a development environment configured to your liking, but I highly recommend ThoughtBot's (creator of FactoryGirl and PaperClip) extremely easy (it couldn't be more simple) development setup.

It's a script for OS X that configures Postgres, Foreman, Heroku Toolbelt, ImageMagick, Rbenv, Redis, Tmux, and more. Don't worry though as it'll automatically skip what you have already setup.

To install Thoughtbot's setup, execute the script below:

curl --remote-name https://raw.githubusercontent.com/thoughtbot/laptop/master/mac
less mac
sh mac 2>&1 | tee ~/laptop.log

For more info, visit https://github.com/thoughtbot/laptop