2017-03-12 18 views
0

こんにちは誰か助けてください!それをたくさんありがとう!pg gemをRailsにインストールできません(PostgreSQL 9.6を使用)

端末にgem pg v 0.20.0のインストールに失敗したとのメッセージが表示されるため、いくつか問題が発生します。 gem pgをインストールしようとするとこのエラーが発生します。私は現在PostgreSQL 9.6を使用しています。私は同様の質問ですべてのソリューションを試しましたが、何も動作しません.PGを再設定しようとしています。

198-195:Review minhvu$ gem install pg -- --with-pg-config=/usr/pgsql-9.6/bin/pg_config Building native extensions with: '--with-pg-config=/usr/pgsql-9.6/bin/pg_config' This could take a while... ERROR: Error installing pg: ERROR: Failed to build gem native extension.

current directory: /Users/minhvu/.rvm/gems/ruby-2.3.0/gems/pg-0.20.0/ext /Users/minhvu/.rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20170313-7016-1if947v.rb extconf.rb --with-pg-config=/usr/pgsql-9.6/bin/pg_config Using config values from /usr/pgsql-9.6/bin/pg_config sh: /usr/pgsql-9.6/bin/pg_config: No such file or directory sh: /usr/pgsql-9.6/bin/pg_config: No such file or directory * 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/minhvu/.rvm/rubies/ruby-2.3.0/bin/$(RUBY_BASE_NAME) --with-pg --without-pg --enable-windows-cross --disable-windows-cross --with-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 /Users/minhvu/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/mkmf.rb:456:in try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /Users/minhvu/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/mkmf.rb:541:in try_link0' from /Users/minhvu/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/mkmf.rb:556:in try_link' from extconf.rb:40:in '

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

/Users/minhvu/.rvm/gems/ruby-2.3.0/extensions/x86_64-darwin-16/2.3.0/pg-0.20.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/minhvu/.rvm/gems/ruby-2.3.0/gems/pg-0.20.0 for inspection. Results logged to /Users/minhvu/.rvm/gems/ruby-2.3.0/extensions/x86_64-darwin-16/2.3.0/pg-0.20.0/gem_make.out

答えて

1

あなたがPG宝石をインストールしようとしているが、最初のあなたのシステムにPostgreSQLをインストールする必要があること、私には思えます。あなたが持っているシステムに応じて、この記事の指示に従ってください。私は次のポスト

Rails Error Installing PG

Steps to install

  1. Install PostgreSQL and its libraries
sudo apt-get install postgresql postgresql-contrib libpq-dev 
  1. After the installation create a user for postgresql
sudo -u postgres createuser --superuser $USER 

or

sudo -u postgres createuser pgs_root 
  1. Set user password for the postgresql user
にはまっ Addictedユーザーからの回答を引用しています
  1. Configure the postgresql.conf file to make PostgreSQL listen to localhost or listen on an external IP or something, change this line to either the IP or 'localhost'
 gedit /etc/postgresql/8.4/main/postgresql.conf listen_addresses = 'localhost 
関連する問題