Installing rails app with sqlite on heroku - ruby-on-rails

Hi i am trying to deploy my rails app to heroku using sqlite
reading previous stackoverflow answers
i changed my gemfile as follows
group :production, :staging do
gem 'pg', '0.17.1'
end
group :development, :test do
gem 'sqlite3'
end
but still it is giving error on bundle install
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/akash.bansal/.rvm/rubies/ruby-1.9.3-p448/bin/ruby 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... no
Can't find the 'libpq-fe.h header
* 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
--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=/Users/akash.bansal/.rvm/rubies/ruby-1.9.3-p448/bin/ruby
--with-pg
--without-pg
--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
extconf failed, exit code 1
Gem files will remain installed in /Users/akash.bansal/sites/onemustwatch/.bundle/ruby/1.9.1/gems/pg-0.17.1 for inspection.
Results logged to /Users/akash.bansal/sites/onemustwatch/.bundle/ruby/1.9.1/extensions/x86_64-darwin-13/1.9.1/pg-0.17.1/gem_make.out`

You need to install Postgres on your local machine in order to run bundle install. To do that run brew install postgresql. If you don't have Homebrew, you can install it here

Related

Rails PG Hartl Tutorial error

I am doing the Hartl Tutorial and have gotten to the step for deployment to Heroku. I am getting this error when installing the pg gem. I have already tried to run the --without production command, but I am still getting this error. I copy and pasted my gem file from his so I know there isn't an error in syntax.
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/KohlKohlbrenner/.rvm/rubies/ruby-2.1.2/bin/ruby 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... no
Can't find the 'libpq-fe.h header
*** 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=/Users/KohlKohlbrenner/.rvm/rubies/ruby-2.1.2/bin/ruby
--with-pg
--without-pg
--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
extconf failed, exit code 1
Gem files will remain installed in /Users/KohlKohlbrenner/.rvm/gems/ruby-2.1.2/gems/pg- 0.17.1 for inspection.
Results logged to /Users/KohlKohlbrenner/.rvm/gems/ruby-2.1.2/extensions/x86_64-darwin- 13/2.1.0-static/pg-0.17.1/gem_make.out
An error occurred while installing pg (0.17.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.17.1'` succeeds before bundling.

My project Ruby On Rails cannot install gem postgre in CentOS 6.2

Although many sources of references from stackoverflow but my problem has not been resolved. When I run My project (ProjectJapanFull_New) on window server it no problem, but when I switched it to CentOS server 6.2 is an error, namely:
[root#links02 ProjectJapanFull_New]# rails -v
You have requested:
pg >= 0
The bundle currently has pg locked at 0.17.0.
Try running `bundle update pg`
Run `bundle install` to install missing gems.
Then I run: bundle install another error show:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-1.9.3-p547/bin/ruby 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... no
Can't find the 'libpq-fe.h header
*** 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/local/rvm/rubies/ruby-1.9.3-p547/bin/ruby
--with-pg
--without-pg
--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
extconf failed, exit code 1
Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p547/gems/pg-0.17.0 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p547/extensions/x86_64-linux/1.9.1/pg-0.17.0/gem_make.out
An error occurred while installing pg (0.17.0), and Bundler cannot continue.
Make sure that `gem install pg -v '0.17.0'` succeeds before bundling.
When i run gem install pg -v '0.17.0' show this error:
[root#links02 ProjectJapanFull_New]# gem install pg -v '0.17.0'
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-1.9.3-p547/bin/ruby 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... no
Can't find the 'libpq-fe.h header
*** 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/local/rvm/rubies/ruby-1.9.3-p547/bin/ruby
--with-pg
--without-pg
--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
extconf failed, exit code 1
Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p547/gems/pg-0.17.0 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p547/extensions/x86_64-linux/1.9.1/pg-0.17.0/gem_make.out

Can't install postgresql gem on mac

I'll be deploying my app on Heroku but wish to develop locally on SQLite. This is the code that I added to my Gemfile.
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'postgresql'
end
When I do bundle install, this is the error that I get.
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/Fulcrum/.rbenv/versions/2.1.0/bin/ruby 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... no
Can't find the 'libpq-fe.h header
*** 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=/Users/Fulcrum/.rbenv/versions/2.1.0/bin/ruby
--with-pg
--without-pg
--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
extconf failed, exit code 1
Gem files will remain installed in /Users/Fulcrum/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/pg-0.17.1 for inspection.
Results logged to /Users/Fulcrum/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-13/2.1.0-static/pg-0.17.1/gem_make.out
An error occurred while installing pg (0.17.1), and Bundler cannot continue.
Make sure that `gem install pg -v '0.17.1'` succeeds before bundling.
Try bundle install without production:
bundle install --without production
Install the libpq-dev which is missing.
brew install libpq-dev
and then do bundle install, this should solve your problem.

Cant install the postgresql gem

$ sudo gem install pg Building native extensions. This could take a
while... ERROR: Error installing pg: ERROR: Failed to build gem
native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
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... no Can't find the 'libpq-fe.h header
* 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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
--with-pg
--without-pg
--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}
/ Gem files will remain installed in
/Library/Ruby/Gems/2.0.0/gems/pg-0.17.1 for inspection. Results logged
to /Library/Ruby/Gems/2.0.0/gems/pg-0.17.1/ext/gem_make.out
In the error message, it specifically states ERROR: Failed to build gem native extension. This most likely means that you don't have the 'native' extension installed, which is the PostgreSQL actual software.
This is because the native extension is required to run the gem, as the gem is only a ruby wrapper for the actual database software. Detailed instructions can be found here for how to install Postgres.

error running gem install pg -v '0.15.1'

Running
gem install pg -v '0.15.1'
giving errors:
Building native extensions. This could take a while... ERROR: Error
installing pg: ERROR: Failed to build gem native extension.
/home/askar/.rvm/rubies/ruby-1.9.3-p429/bin/ruby 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... no Can't find the 'libpq-fe.h header
* 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=/home/askar/.rvm/rubies/ruby-1.9.3-p429/bin/ruby --with-pg
--without-pg --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-pg-config --without-pg-config
--with-pg_config --without-pg_config
Gem files will remain installed in
/home/askar/.rvm/gems/ruby-1.9.3-p429/gems/pg-0.15.1 for inspection.
Results logged to
/home/askar/.rvm/gems/ruby-1.9.3-p429/gems/pg-0.15.1/ext/gem_make.out
I'm using
Rails 4.0.0.rc1
Ruby 1.9.3-p429
Linux Mint Nadia v 14
You need to install a native extension for the pg gem.
sudo apt-get install libpq-dev

Resources