[英]Make sure that `gem install pg -v '0.18.4'` succeeds before bundling
I get the below error when I execute bundle update
: 执行bundle update
时出现以下错误:
To see why this extension failed to compile, please check the mkmf.log which can 要查看此扩展为何无法编译,请检查mkmf.log,该文件可以
be found here: 在这里找到:/Users/jack/.rvm/gems/ruby-2.3.3/extensions/x86_64-darwin-16/2.3.0/pg-0.18.4/mkmf.log /Users/jack/.rvm/gems/ruby-2.3.3/extensions/x86_64-darwin-16/2.3.0/pg-0.18.4/mkmf.log
extconf failed, exit code 1 extconf失败,退出代码1
Gem files will remain installed in 宝石文件将继续安装在
/Users/jack/.rvm/gems/ruby-2.3.3/gems/pg-0.18.4 for inspection. /Users/jack/.rvm/gems/ruby-2.3.3/gems/pg-0.18.4进行检查。 Results logged to 结果记录到
/Users/jack/.rvm/gems/ruby-2.3.3/extensions/x86_64-darwin-16/2.3.0/pg-0.18.4/gem_make.out /Users/jack/.rvm/gems/ruby-2.3.3/extensions/x86_64-darwin-16/2.3.0/pg-0.18.4/gem_make.outAn error occurred while installing pg (0.18.4), and Bundler cannot continue. 安装pg(0.18.4)时发生错误,并且Bundler无法继续。
Make sure thatgem install pg -v '0.18.4'
succeeds before bundling. 捆绑之前,请确保gem install pg -v '0.18.4'
成功。
I don't know why I get this issue. 我不知道为什么会遇到这个问题。 And I execute the gem install pg -v '0.18.4'
: 然后执行gem install pg -v '0.18.4'
:
To see why this extension failed to compile, please check the mkmf.log which can be found here: 要查看此扩展为何无法编译,请检查mkmf.log,可在此处找到:
/Users/jack/.rvm/gems/ruby-2.3.3/extensions/x86_64-darwin-16/2.3.0/pg-0.18.4/mkmf.log /Users/jack/.rvm/gems/ruby-2.3.3/extensions/x86_64-darwin-16/2.3.0/pg-0.18.4/mkmf.log
extconf failed, exit code 1 extconf失败,退出代码1
Gem files will remain installed in /Users/jack/.rvm/gems/ruby-2.3.3/gems/pg-0.18.4 for inspection. 宝石文件将保留安装在/Users/jack/.rvm/gems/ruby-2.3.3/gems/pg-0.18.4中进行检查。 Results logged to /Users/jack/.rvm/gems/ruby-2.3.3/extensions/x86_64-darwin-16/2.3.0/pg-0.18.4/gem_make.out 结果记录到/Users/jack/.rvm/gems/ruby-2.3.3/extensions/x86_64-darwin-16/2.3.0/pg-0.18.4/gem_make.out
My Gemfile is this: 我的Gemfile是这样的:
source 'https://gems.ruby-china.org'
gem 'rails', '5.0.0.1'
gem 'puma', '3.4.0'
gem 'sass-rails', '5.0.6'
gem 'uglifier', '3.0.0'
gem 'coffee-rails', '4.2.1'
gem 'jquery-rails', '4.1.1'
gem 'turbolinks', '5.0.1'
gem 'jbuilder', '2.4.1'
group :development, :test do
gem 'sqlite3', '1.3.11'
gem 'byebug', '9.0.0', platform: :mri
end
group :development do
gem 'web-console', '3.1.1'
gem 'listen', '3.0.8'
gem 'spring', '1.7.2'
gem 'spring-watcher-listen', '2.0.0'
end
group :production do gem 'pg', '0.18.4'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
Edit -1 编辑-1
My OS is macOS Sierra 我的操作系统是macOS Sierra
I had a similar problem and this is what worked for me: 我有一个类似的问题,这对我有用:
(Note: First make sure you've got XCode and homebrew installed) (注意:首先请确保已安装XCode和自制软件)
brew install postgresql
gem uninstall pg
- this might not return anything, that's ok. gem uninstall pg
这可能不会返回任何内容,没关系。
Then in your app's directory, either bundle install
or gem install pg
然后在您应用的目录中, bundle install
或gem install pg
This issue often comes up and mostly results in obsolete version of Postgres. 通常会出现此问题,并且大多数情况会导致Postgres版本过时。 Try 尝试
brew update
brew install postgresql
bundle install
If you still need to use that version of Postgres you can specify the path to the 'pg_config': 如果仍然需要使用该版本的Postgres,则可以指定“ pg_config”的路径:
gem install pg -- --with-pg-config=<path to pg_config>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.