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'
感謝任何輸入!
您是否嘗試過使用'subst X:「C:/ Program Files(x86)/PostgreSQL/9.5/」'的標準方法? – Alik
關於部署到heroku:在您的Gemfile中使用'gem'activerecord-jdbcpostgresql-adapter',platforms :: jruby'代替'gem'pg'' – Alik
謝謝Alik你回到我身邊。我嘗試但:$ subst X:「D:/ Program Files/PostgreSQL/9.0」 sh.exe「:subst:命令未找到 –