1
votes

when running existing ruby on rails project from another machine to my fedora machine. running bundle install command gives following error:

when running: bundle install with gem 'pg', '~> 0.18' in gem file, it says bundle need to install gem install pg -v '0.18' , then running gem install pg -v '0.18' gives following error:

Building native extensions. This could take a while... ERROR: Error installing pg: ERROR: Failed to build gem native extension.

current directory: /home/aps/.rvm/gems/ruby-2.4.1/gems/pg-0.21.0/ext /home/aps/.rvm/rubies/ruby-2.4.1/bin/ruby -r ./siteconf20180626-32726-dfgy1l.rb extconf.rb

checking for pg_config... no No pg_config... trying anyway.

If building fails, please try again with --with-pg-config=/path/to/pg_config checking for libpq-fe.h...

Can't find the 'libpq-fe.h header


These two gems couldn't install : gem 'pg', '~> 0.18' and gem 'rjb'

1
welcome to stackoverflow! Can you please attached the error log in question?Ajay Barot

1 Answers

0
votes

As per the details shared, it is giving error because the native dependencies of nio4r was installed on some other machine and the same cannot be found on your machine that is why it is showing error:

At first try to install build essentials:

sudo dnf install build-essential patch

sudo dnf install libgmp3-dev

Now, try running following:

bundle install

For pg error as shown in the post:

sudo dnf install /usr/include/libpq-fe.h

If the above command does not work then run

sudo dnf install postgresql-devel