Se ha producido un error al instalar pg (0.17.1) y Bundler no puede continuar
Acabo de instalar Rails 4.0.2
y al crear una nueva aplicación, en la etapa de paquete obtengo:
Installing pg (0.17.1)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/Dee/.rvm/rubies/ruby-2.0.0-p247/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.
¿Cómo soluciono esto?
13 answers
Estoy en un Mac ejecutando Mavericks. Mi solución fue instalar Postgres.
Y luego en terminal install usando homebrew con la configuración:
gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/latest/bin/pg_config
Nota: Esta respuesta se ha editado para usar el enlace simbólico latest
que se incluye actualmente en las versiones de envío de la aplicación Postgres.
Versiones anteriores sugeridas:
gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-05-04 08:29:35
Se ha presentado algún tipo de error Instalando PG gem en OS X-fallo en la compilación de la extensión nativa
Para instalar dependencias en Ubuntu prueba esto:
sudo apt-get install libpq-dev
Y esto
gem install pg
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-05-23 12:26:24
Raíz de la aplicación:
- actualización de brew
- instalación de cerveza postgres
- gem install pg with with-pg-config = /usr/local / Cellar/postgresql/9.3.4/bin/pg_config
- instalación del paquete
- ln-sfv /usr/local/opt/postgresql/*.plist ~ / Library / LaunchAgents
- launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
- createuser-s-r postgres
- rake db: create: all
- rake db: migrar
- rails s
NOTA: reemplace el número de versión en el paso 3 si es necesario.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-05-07 21:41:59
Respuesta que funcionaba previamente con una versión anterior
Instalé bajo mac OSX Mavericks, teniendo la aplicación postgres (Versión 9.2.2.0) desde www.postgresapp.com instalado. El problema subyacente era simpy que desde postgres se instaló a través de la aplicación, el archivo de configuración reside en una ubicación que no es la predeterminada cuando se instala sin postgressapp. así que tenemos que decirle a gem dónde encontrar este archivo por:
Instalar gema pg -- --with-pg-config= / Applications / Postgres.app / Contents/macOS/bin / pg_config
Espero que ayude
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-11-23 19:01:13
Si la instalación de gem pg falla, pruebe el siguiente comando:
env ARCHFLAGS="-arch x86_64" gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/MacOS/bin/pg_config
... desde el PostgreSQL.documentación de la aplicación
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-12-24 02:57:06
Parece que no tiene instalado PostgreSQL. La gema pg
requiere algunas cabeceras de PostgreSQL para compilar la extensión nativa.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-12-24 02:38:40
Tuve que combinar todo y usar
sudo env ARCHFLAGS="-arch x86_64" gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-04-28 16:28:31
Si está usando algo que no sea Postgres en desarrollo y Postgres solo en producción, puede agregar la gema pg a su gemfile de esta manera...
group :production do
gem 'pg', '0.17.1'
end
Luego use bundle install --without production
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-08-14 05:12:09
Para los usuarios de CentOS:
sudo yum install postgresql-devel
Y
gem install pg
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-10-19 05:47:17
Después de instalar Postgres tuve que ejecutar el siguiente comando
env ARCHFLAGS="-arch x86_64" gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config
Después de este paquete de instalación funciona muy bien!
Espero que ayude
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-11-02 01:26:52
La forma en que logré superar ese error fue:
- cd a la carpeta app y luego establecer la versión de ruby localmente. Estoy usando ruby 2.1.2.
Rbenv local 2.1.2
- en lugar de solo ejecutar bundle install, instale las gemas en vendor / bundle
Bundle install vendor path vendor / bundle
Esto lo hizo por mí.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-11-18 15:36:38
Necesitaba usar sudo
sudo gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.5/bin/pg_config
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-02-29 00:18:39
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-01-27 23:13:03