rails_tutorial_3rd_edition_gemfiles icon indicating copy to clipboard operation
rails_tutorial_3rd_edition_gemfiles copied to clipboard

Gemfile of hello_app cannot be run

Open danadanad opened this issue 8 years ago • 5 comments

It shows a lot of problem, such as:

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.

Could not find gem 'sass-rails (= 5.0.2)' in any of the gem sources listed in your Gemfile or available on this machine.

danadanad avatar May 08 '16 02:05 danadanad

Hi, I've the same problem with p gem, thanks.

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.

ghost avatar May 08 '16 11:05 ghost

Ronaks-MacBook-Air:hello_app ronakvyas$ gem install pg -v '0.17.1' Building native extensions. This could take a while... ERROR: Error installing pg: ERROR: Failed to build gem native extension.

current directory: /Users/ronakvyas/.rvm/gems/ruby-2.3.1/gems/pg-0.17.1/ext

/Users/ronakvyas/.rvm/rubies/ruby-2.3.1/bin/ruby -r ./siteconf20160509-33077-m55nyx.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... 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/ronakvyas/.rvm/rubies/ruby-2.3.1/bin/$(RUBY_BASE_NAME) --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

To see why this extension failed to compile, please check the mkmf.log which can be found here:

/Users/ronakvyas/.rvm/gems/ruby-2.3.1/extensions/x86_64-darwin-15/2.3.0/pg-0.17.1/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/ronakvyas/.rvm/gems/ruby-2.3.1/gems/pg-0.17.1 for inspection. Results logged to /Users/ronakvyas/.rvm/gems/ruby-2.3.1/extensions/x86_64-darwin-15/2.3.0/pg-0.17.1/gem_make.out

This happened with me too. I tried installing that gem but still it broke like above.

ronaksvyas avatar May 09 '16 12:05 ronaksvyas

But the app works in default Gemfile which I had.

ronaksvyas avatar May 09 '16 12:05 ronaksvyas

Here's how I fixed it (with home-brew):

  1. brew update
  2. brew install postgresql
  3. After that 'gem install pg' worked for me.

ghost avatar May 11 '16 17:05 ghost

Thanks. This worked for me. Turns out I didn't know that I had Postgresql or not.

ronaksvyas avatar May 12 '16 06:05 ronaksvyas