我知道这个问题在某种程度上是众所周知的,但没有一个帖子可以帮助我。我试图在Windows 8.1上安装pg gem(其中包括:ruby 2.1.7.p400,PostgreSQL 9.5 32bit和devkit 32bit)。在GitBash中我放了:
$ gem install pg -- --with-pg-include="C:/Program Files (x86)/PostgreSQL/include" --with-pg-lib="C:/Program Files (x86)/PostgreSQL/lib" --with-pg-config="C:/Program Files (x86)/PostgreSQL/9.5/bin/pg_config"
我得到了:
Temporarily enhancing PATH to include DevKit...
Building native extensions with: '--with-pg-include=C:/Program Files (x86)/PostgreSQL/include --with-pg-lib=C:/Program Files (x86)/PostgreSQL/lib --with-pg-config=C:/Program Files (x86)/PostgreSQL/9.5/bin/pg_config'
This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
c:/Ruby217/bin/ruby.exe extconf.rb --with-pg-include=C:/Program Files (x86)/PostgreSQL/include --with-pg-lib=C:/Program Files (x86)/PostgreSQL/lib --with-pg-config=C:/Program Files (x86)/PostgreSQL/9.5/bin/pg_config
Using config values from C:/Program
*** 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=c:/Ruby217/bin/ruby
--with-pg
--without-pg
--enable-windows-cross
--disable-windows-cross
--with-pg-config
extconf.rb:29:in ``': No such file or directory - "C:/Program" --includedir (Errno::ENOENT) from extconf.rb:29:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in c:/Ruby217/lib/ruby/gems/2.1.0/gems/pg-0.18.4 for inspection.
Results logged to c:/Ruby217/lib/ruby/gems/2.1.0/extensions/x86-mingw32/2.1.0/pg-0.18.4/gem_make.out
上图是我尝试将应用推送到heroku的更大图片的一部分:
$ git push heroku master
Counting objects: 10, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (10/10), done.
Writing objects: 100% (10/10), 1.42 KiB | 0 bytes/s, done.
Total 10 (delta 6), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Using set buildpack heroku/ruby
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.2.2-jruby-9.0.0.0
remote: -----> Installing JVM: openjdk-8
remote: ###### WARNING:
remote: Removing `Gemfile.lock` because it was generated on Windows.
remote: Bundler will do a full resolve so native gems are handled properl
y.
remote: This may result in unexpected gem versions being used in your app
.
remote: In rare occasions Bundler may not be able to resolve your depende
ncies at all.
remote: https://devcenter.heroku.com/articles/bundler-windows-gemfile
remote:
remote: -----> Installing dependencies using bundler 1.9.7
remote: Ruby version change detected. Clearing bundler cache.
remote: Old: ruby 2.0.0p648 (2015-12-16 revision 53162) [x86_64-linux]
remote: New: jruby 9.0.0.0 (2.2.2) 2015-07-22 fffffff OpenJDK 64-Bit Serv
er VM 25.66-b17 on 1.8.0_66-cedar14-b17 +jit [linux-amd64]
remote: Running: bundle install --without development:test --path vendor/
bundle --binstubs vendor/bundle/bin -j4
remote: Fetching gem metadata from https://rubygems.org/.............
remote: Fetching version metadata from https://rubygems.org/...
remote: Fetching dependency metadata from https://rubygems.org/..
remote: Resolving dependencies............
remote: Installing json 1.8.3
remote: Installing i18n 0.7.0
remote: Installing rake 10.5.0
remote: Installing minitest 5.8.3
remote: Installing thread_safe 0.3.5
remote: Installing builder 3.2.2
remote: Installing rack 1.6.4
remote: Installing erubis 2.7.0
remote: Installing arel 6.0.3
remote: Installing mime-types 2.99
remote: Using bundler 1.9.7
remote: Installing coffee-script-source 1.10.0
remote: Installing jmespath 1.1.3
remote: Installing nokogiri 1.6.7.1
remote: Installing execjs 2.6.0
remote: Installing thor 0.19.1
remote: Installing concurrent-ruby 1.0.0
remote: Installing mimemagic 0.3.0
remote: Installing tilt 2.0.2
remote: Installing tzinfo 1.2.2
remote: Installing sass 3.4.21
remote: Installing rack-test 0.6.3
remote: Installing mail 2.6.3
remote: Installing loofah 2.0.3
remote: Installing coffee-script 2.4.1
remote: Gem::Ext::BuildError: ERROR: Failed to build gem native extension
.
remote: /tmp/build_750303b177c14834e4a3ef518ae3807a/vendor/ruby-2.2.2-jru
by-9.0.0.0/bin/jruby -r ./siteconf20160119-510-12sshco.rb extconf.rb
remote: NotImplementedError: C extensions are not supported
remote: <top> at /tmp/build_750303b177c14834e4a3ef518ae3807a/vendor/ruby-
2.2.2-jruby-9.0.0.0/lib/ruby/stdlib/mkmf.rb:1
remote: require at org/jruby/RubyKernel.java:940
remote: (root) at /tmp/build_750303b177c14834e4a3ef518ae3807a/vendor/ruby
-2.2.2-jruby-9.0.0.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1
remote: <top> at extconf.rb:2
remote: extconf failed, exit code 1
remote: Gem files will remain installed in /tmp/build_750303b177c14834e4a
3ef518ae3807a/vendor/bundle/jruby/2.2.0/gems/pg-0.17.1 for inspection.
remote: Results logged to /tmp/build_750303b177c14834e4a3ef518ae3807a/ven
dor/bundle/jruby/2.2.0/extensions/universal-java-1.8/2.2.0/pg-0.17.1/gem_make.ou
t
remote: Installing uglifier 2.7.2
remote: Installing aws-sdk-core 2.2.11
remote: Installing sprockets 3.5.2
remote: Installing rails-html-sanitizer 1.0.2
remote: Installing activesupport 4.2.5
remote: Installing tzinfo-data 1.2015.7
remote: An error occurred while installing pg (0.17.1), and Bundler canno
t continue.
remote: Make sure that `gem install pg -v '0.17.1'` succeeds before bundl
ing.
remote: Bundler Output: Fetching gem metadata from https://rubygems.org/.
............
remote: Fetching version metadata from https://rubygems.org/...
remote: Fetching dependency metadata from https://rubygems.org/..
remote: Resolving dependencies............
remote: Installing json 1.8.3
remote: Installing i18n 0.7.0
remote: Installing rake 10.5.0
remote: Installing minitest 5.8.3
remote: Installing thread_safe 0.3.5
remote: Installing builder 3.2.2
remote: Installing rack 1.6.4
remote: Installing erubis 2.7.0
remote: Installing arel 6.0.3
remote: Installing mime-types 2.99
remote: Using bundler 1.9.7
remote: Installing coffee-script-source 1.10.0
remote: Installing jmespath 1.1.3
remote: Installing nokogiri 1.6.7.1
remote: Installing execjs 2.6.0
remote: Installing thor 0.19.1
remote: Installing concurrent-ruby 1.0.0
remote: Installing mimemagic 0.3.0
remote: Installing tilt 2.0.2
remote: Installing tzinfo 1.2.2
remote: Installing sass 3.4.21
remote: Installing rack-test 0.6.3
remote: Installing mail 2.6.3
remote: Installing loofah 2.0.3
remote: Installing coffee-script 2.4.1
remote:
remote: Gem::Ext::BuildError: ERROR: Failed to build gem native extension
.
remote:
remote: /tmp/build_750303b177c14834e4a3ef518ae3807a/vendor/ruby-2.2.2-jru
by-9.0.0.0/bin/jruby -r ./siteconf20160119-510-12sshco.rb extconf.rb
remote: NotImplementedError: C extensions are not supported
remote: <top> at /tmp/build_750303b177c14834e4a3ef518ae3807a/vendor/ruby-
2.2.2-jruby-9.0.0.0/lib/ruby/stdlib/mkmf.rb:1
remote: require at org/jruby/RubyKernel.java:940
remote: (root) at /tmp/build_750303b177c14834e4a3ef518ae3807a/vendor/ruby
-2.2.2-jruby-9.0.0.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1
remote: <top> at extconf.rb:2
remote:
remote: extconf failed, exit code 1
remote:
remote: Gem files will remain installed in /tmp/build_750303b177c14834e4a
3ef518ae3807a/vendor/bundle/jruby/2.2.0/gems/pg-0.17.1 for inspection.
remote: Results logged to /tmp/build_750303b177c14834e4a3ef518ae3807a/ven
dor/bundle/jruby/2.2.0/extensions/universal-java-1.8/2.2.0/pg-0.17.1/gem_make.ou
t
remote: Installing uglifier 2.7.2
remote: Installing aws-sdk-core 2.2.11
remote: Installing sprockets 3.5.2
remote: Installing rails-html-sanitizer 1.0.2
remote: Installing activesupport 4.2.5
remote: Installing tzinfo-data 1.2015.7
remote: An error occurred while installing pg (0.17.1), and Bundler canno
t continue.
remote: Make sure that `gem install pg -v '0.17.1'` succeeds before bundl
ing.
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote:
remote: ! Push rejected, failed to compile Ruby app
remote:
因此我尝试安装pg -v&#39; 0.17.1&#39;或任何pg。
我不确定这是不是问题但是当我开始使用heroku时我使用了ruby-2.2.2-,engine-jruby-9.0.0.0和现在(安装pg时)我使用ruby&#39; 2.1 .7&#39;,:engine =&gt; &#39; ruby&#39;,:engine_version =&gt; &#39; 2.1.7&#39;
感谢任何投入!
答案 0 :(得分:0)
当前的pg gem是错误的,对我来说有点神奇的是将这个预版本添加到我的gemfile中 所以转到你的gem文件并添加 gem'pg','〜&gt; 0.19.0.pre20160409114042'
然后运行bundle install,如果其他一切正常,它将正常工作。如果没有,请说出新的错误。