Ruby on rails 运行“bundle install”时“pg gem”安装出错
在运行“bundle安装”时,我突然遇到了这个问题。一切似乎都安装正确,但后来我遇到了“pg”的问题,就像许多其他人一样。正如消息所说,我尝试运行“gem install pg-”0.12.2,但仍然失败 我使用的是雪豹10.6,这是我得到的错误:Ruby on rails 运行“bundle install”时“pg gem”安装出错,ruby-on-rails,ruby,bundle,pg,Ruby On Rails,Ruby,Bundle,Pg,在运行“bundle安装”时,我突然遇到了这个问题。一切似乎都安装正确,但后来我遇到了“pg”的问题,就像许多其他人一样。正如消息所说,我尝试运行“gem install pg-”0.12.2,但仍然失败 我使用的是雪豹10.6,这是我得到的错误: Installing pg (0.12.2) with native extensions Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extensi
Installing pg (0.12.2) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/thomaskim/.rvm/rubies/ruby-1.9.3-p327/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/thomaskim/.rvm/rubies/ruby-1.9.3-p327/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 /Users/thomaskim/.bundler/tmp/1336/gems/pg-0.12.2 for inspection.
Results logged to /Users/thomaskim/.bundler/tmp/1336/gems/pg-0.12.2/ext/gem_make.out
An error occurred while installing pg (0.12.2), and Bundler cannot continue.
Make sure that `gem install pg -v '0.12.2'` succeeds before bundling.
您似乎没有正确安装postgres。我在尝试用npm安装pg模块时也遇到了类似的错误。在正确安装postgres后,它消失了。
这里有一个下载链接:您似乎没有正确安装postgres。我在尝试用npm安装pg模块时也遇到了类似的错误。在正确安装postgres后,它消失了。
这里有一个下载链接:如果您仅在开发模式下在机器上运行rails并使用SQLLite,则无需安装生产捆绑包 因此,如果您的GEM文件看起来像这样:
group :production do
gem 'pg'
end
尝试使用以下命令安装捆绑包:
gem install --without production
如果您仅在dev模式下在机器上运行rails并使用sqllite,则不需要安装生产捆绑包 因此,如果您的GEM文件看起来像这样:
group :production do
gem 'pg'
end
尝试使用以下命令安装捆绑包:
gem install --without production
首先,您需要确保已安装Xcode的命令行工具包。因为您使用的是旧版本的OSX,所以您必须研究如何做到这一点 然后,使用自制安装postgress
brew install postgres
在那之后,一切都应该捆绑起来,没有问题 首先,您需要确保已安装用于Xcode的命令行工具包。因为您使用的是旧版本的OSX,所以您必须研究如何做到这一点 然后,使用自制安装postgress
brew install postgres
在那之后,一切都应该捆绑起来,没有问题 您是否安装了postgresql?是的,我确实使用一键式安装程序安装了postgresql,但仍然存在问题。您是否尝试过此提示?没有pg_配置。。。无论如何都要努力。如果生成失败,请使用-with pg config=/path/to/pg_config重试您是否安装了postgresql?是的,我确实使用一键式安装程序安装了postgresql,但仍然存在问题。您是否尝试过此提示?没有pg_配置。。。无论如何都要努力。如果构建失败,请使用-with pg config=/path/to/pg_config重试在不同的数据库上开发和部署是一个巨大的错误,特别是如果您是在像SQLite这样松懈的基础上开发的。Rails默认使用SQLite对于Rails开发人员来说是完全愚蠢的,请不要鼓励这种错误。在不同的数据库上开发和部署是一个巨大的错误,特别是如果您是在像SQLite这样松懈的基础上开发的话。Rails默认使用SQLite完全是Rails开发者的愚蠢行为,请不要鼓励这种错误。谢谢@sheldonk,但我使用了postgresql的一键式安装程序,我仍然面临同样的问题。我最终只是通过自制软件安装,现在一切正常。谢谢你的帮助!谢谢@sheldonk,但是我使用了postgresql的一键式安装程序,我仍然面临着同样的问题。我最终只是通过自制软件安装,现在一切都很好。谢谢你的帮助!