2016-01-19 143 views
0

我知道这个问题在某种程度上是已知的,但是没有文章可以帮助我。我试图在Windows 8.1上安装pg gem(其中包括:ruby 2.1.7.p400,PostgreSQL 9.5 32bit和devkit 32bit)。在GitBash我把:在windows上安装pg gem crushes

$ 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'0.17.1'或任何pg。

我不确定是否可以成为问题,但是当我开始使用heroku时,我使用了ruby-2.2.2-,engine-jruby-9.0.0.0和现在(在安装pg时)我使用ruby'2.1.7 ',:engine =>'ruby',:engine_version =>'2.1.7'

感谢任何输入!

+0

您是否尝试过使用'subst X:“C:/ Program Files(x86)/PostgreSQL/9.5/”'的标准方法? – Alik

+0

关于部署到heroku:在您的Gemfile中使用'gem'activerecord-jdbcpostgresql-adapter',platforms :: jruby'代替'gem'pg'' – Alik

+0

谢谢Alik你回到我身边。我尝试但:$ subst X:“D:/ Program Files/PostgreSQL/9.0” sh.exe“:subst:命令未找到 –

回答

0

目前皮克的宝石是越野车,什么,像变魔术一样对我来说是增加这个前的版本我的Gemfile 所以去你的宝石文件,并添加 宝石“PG”,“〜> 0.19.0.pre20160409114042”

然后运行bundle install,如果一切正常,它会工作得很好。如果没有,请告诉新的错误。