我正在嘗試捆綁安裝我從 bitbucket 克隆的 ruby??-on-rails 專案,并且在安裝 pg 時它被終止,所以我嘗試單獨安裝 pg。
當我運行 gem install pg -v '0.20.0' 時,會顯示以下日志
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
current directory: D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/pg-0.20.0/ext
D:/Ruby31-x64/bin/ruby.exe -I D:/Ruby31-x64/lib/ruby/site_ruby/3.1.0 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
--without-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=D:/Ruby31-x64/bin/$(RUBY_BASE_NAME)
--with-pg
--without-pg
--enable-windows-cross
--disable-windows-cross
--with-pg-config
--without-pg-config
--with-pg_config
--without-pg_config
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib
To see why this extension failed to compile, please check the mkmf.log which can be found here:
D:/Ruby31-x64/lib/ruby/gems/3.1.0/extensions/x64-mingw-ucrt/3.1.0/pg-0.20.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/pg-0.20.0 for inspection.
Results logged to D:/Ruby31-x64/lib/ruby/gems/3.1.0/extensions/x64-mingw-ucrt/3.1.0/pg-0.20.0/gem_make.out
我該如何解決 ?
- 窗戶 10
- 超級終端
uj5u.com熱心網友回復:
運行此命令:
gem install pg -v '0.20.0' -- --with-pg-config='D:\PostgreSQL\14\bin\pg_config'
這有助于您根據本地系統放置所需的任何版本而不是 0.20.0 和 pg_config 的路徑。
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/505042.html
