I was trying to learn rails and installed ruby on rails on my system. Though I already had an old version of ruby & rails installed. I installed this one as guided in the tutorials and installed a new version of ruby & rails.
I was able to install everything but not able to run rails server
. As it is showing me a lot of errors.
Could not find gem 'pg (>= 0.18, < 2.0)' in any of the gem sources listed in your Gemfile. Run `bundle install` to install missing gems.
Once I run bundle install
, it showing me more errors and not able to install certain bundles.
Showing the list of errors:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/<user>/.rvm/gems/ruby-2.5.3/gems/pg-1.1.3/ext
/usr/share/rvm/rubies/ruby-2.5.3/bin/ruby -r ./siteconf20181122-27002-nh4k6r.rb extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/share/rvm/rubies/ruby-2.5.3/bin/$(RUBY_BASE_NAME)
--with-pg
--without-pg
--enable-windows-cross
--disable-windows-cross
--with-pg-config
--without-pg-config
--with-pg_config
--without-pg_config
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib
--with-pqlib
--without-pqlib
--with-libpqlib
--without-libpqlib
--with-ms/libpqlib
--without-ms/libpqlib
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/<user>/.rvm/gems/ruby-2.5.3/extensions/x86_64-linux/2.5.0/pg-1.1.3/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/<user>/.rvm/gems/ruby-2.5.3/gems/pg-1.1.3 for inspection.
Results logged to /home/<user>/.rvm/gems/ruby-2.5.3/extensions/x86_64-linux/2.5.0/pg-1.1.3/gem_make.out
An error occurred while installing pg (1.1.3), and Bundler cannot continue.
Make sure that `gem install pg -v '1.1.3' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
pg
I know there are many posts related to this issue. I tried many and still not able to figure out, how to fix it. And I don't want to reinstall Ubuntu for this issue.
Can't find the PostgreSQL client library (libpq)
About this line. I have tried to install this package for like 10 times but it's not working.
I also tried to clean up all the packages using rvm cleanup all
but that is not working as well. I am having a lot of permissions errors, showing a sample error below:
chmod: changing permissions of ‘/usr/share/rvm/src/rvm/binscripts’: Operation not permitted
chmod: changing permissions of ‘/usr/share/rvm/src/rvm/docs’: Operation not permitted
chmod: changing permissions of ‘/usr/share/rvm/src/rvm/hooks’: Operation not permitted
chmod: changing permissions of ‘/usr/share/rvm/src/rvm/rvm-test-rvm1’: Operation not permitted
chmod: changing permissions of ‘/usr/share/rvm/src/rvm/config’: Operation not permitted
chmod: changing permissions of ‘/usr/share/rvm/src/rvm/config/solaris’: Operation not permitted
chmod: changing permissions of ‘/usr/share/rvm/src/rvm/contrib’: Operation not permitted
chmod: changing permissions of ‘/usr/share/rvm/src/rvm/contrib/hudson’: Operation not permitted
chmod: changing permissions of ‘/usr/share/rvm/src/rvm/rvm-test’: Operation not permitted
- failed removing /usr/share/rvm/src/rvm - please check ownership and permissions
I have 2 ruby version installed ruby "2.1.5" and "2.5.3". I have installed the new ruby application using "2.5.3". However, the older one required "2.1.5". I want to use ruby application using Postgres. I had Postgres 9.6 on my system earlier but now new installation installed Postgres 11. I am using Ubuntu 14.04. Can anyone help?
Thanks
@Mark:
On sudo apt-get update
. I am getting the following errors:
Reading package lists... Done
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://extras.ubuntu.com trusty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 16126D3A3E5C1192
W: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/trusty/Release
W: Some index files failed to download. They have been ignored, or old ones used instead.
I am going to following the next step now.
I was able to install the postgres and now creating new rails App. This step is showing me error. The full output is too large to add here, so I am going to share the error part here:
Fetching pg 1.1.3
Installing pg 1.1.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/<user>/.rvm/gems/ruby-2.5.3/gems/pg-1.1.3/ext
/usr/share/rvm/rubies/ruby-2.5.3/bin/ruby -r ./siteconf20181122-4385-1kobagm.rb extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/share/rvm/rubies/ruby-2.5.3/bin/$(RUBY_BASE_NAME)
--with-pg
--without-pg
--enable-windows-cross
--disable-windows-cross
--with-pg-config
--without-pg-config
--with-pg_config
--without-pg_config
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib
--with-pqlib
--without-pqlib
--with-libpqlib
--without-libpqlib
--with-ms/libpqlib
--without-ms/libpqlib
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/<user>/.rvm/gems/ruby-2.5.3/extensions/x86_64-linux/2.5.0/pg-1.1.3/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/<user>/.rvm/gems/ruby-2.5.3/gems/pg-1.1.3 for inspection.
Results logged to /home/<user>/.rvm/gems/ruby-2.5.3/extensions/x86_64-linux/2.5.0/pg-1.1.3/gem_make.out
An error occurred while installing pg (1.1.3), and Bundler cannot continue.
Make sure that `gem install pg -v '1.1.3' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
pg
run bundle exec spring binstub --all
bundler: command not found: spring
Install missing gem executables with `bundle install`
here comes that pg
error again. :(