繁体   English   中英

Rails 5:尝试捆绑安装结束与pg gem

[英]Rails 5: trying to bundle install end getting error with pg gem

我正在使用Rails 5和Rubymine ,当我尝试bundler install ,出现以下错误:

compiling pg_type_map_all_strings.c
compiling pg_type_map_by_class.c
compiling pg_type_map_by_column.c
compiling pg_type_map_by_mri_type.c
compiling pg_type_map_by_oid.c
compiling pg_type_map_in_ruby.c
compiling util.c
linking shared-object pg_ext.bundle
ld: file not found: dynamic_lookup
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [pg_ext.bundle] Error 1

make failed, exit code 2

Gem files will remain installed in
/Users/theopap/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/pg-1.0.0 for
inspection.
Results logged to
/Users/theopap/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/extensions/x86_6
4-darwin-16/2.4.0-static/pg-1.0.0/gem_make.out

An error occurred while installing pg (1.0.0), and Bundler cannot continue.
Make sure that `gem install pg -v '1.0.0'` succeeds before bundling.

In Gemfile:
  pg

我尝试根据@Neeraj Gupta的回答卸载pg gem并安装一个新的ge gem,但是在bundler install之后仍然出现此错误。

任何想法为什么会这样?

您可能缺少Postgres Development标头/库(libpq-dev)。

您是如何安装Postgres的?

如果您使用的是MacOS,则可以通过Homebrew安装Postgres,它将为您提供必要的开发标头:

brew install postgresql

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM