Rails 5:尝试捆绑安装结束获取错误与pg gem

时间:2018-01-14 17:26:35

标签: ruby-on-rails postgresql

我正在使用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并根据此answer安装新的bundler install,但仍然会在easy_install jjb-reactive-choice-param-0.3.0 之后显示此错误。

为什么会发生这种情况?

1 个答案:

答案 0 :(得分:0)

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

你是如何安装Postgres的?

如果您使用的是MacOS,可以通过Homebrew安装Postgres,它将包含必要的开发标题:

brew install postgresql