2011-01-11 76 views
0

我在Windows計算機上開發,但部署到Debian。試圖在Rails 3應用程序中使用hpricot。我可以得到寶石用於安裝:Bundler不希望在Windows XP上使用Ruby 1.8.7安裝hpricot

gem install hpricot --platform=mswin32 

但我做到這一點的包文件時 - 它不斷拋出一個錯誤(我認爲這是試圖安裝角度來說,Hpricot的錯誤的版本(而不是Windows專用)

group :production do 
    gem "hpricot", "0.8.3" 
end 

group :development, :test do 
    gem "hpricot", "0.8.3", :platforms => [:mswin, :mingw] 
end 

這是從這裏另一個問題上的計算器 - 但它不是爲我工作

任何想法

PS:

的Windows XP SP3使用Ruby 1.8.7和Rails 3.0.3與1.0.7捆綁

編輯

忘了貼我的錯誤:

bundle install 
Fetching source index for http://rubygems.org/ 
which: no sudo in (.;C:\Program Files\ImageMagick-6.6.5-Q16;C:\ruby\Ruby187\bin;C:\Program Files\ActiveState Komodo Edit 6\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\e\cmd;C:\Program Files\MySQL\MySQL Server 5.1\bin;C:\WINDOWS\system32\WindowsPowerShell\v1.0;c:\tools;C:\gnuwin32\bin;C:\tools\wkhtmltopdf;C:\Python31;C:\Program Files\TortoiseHg\;C:\Program Files\TortoiseGit\bin; c:\program files\videolan\vlc;C:\Program Files\SMPlayer\mplayer;C:\Program Files\Git\cmd;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Calibre2\;c:\ruby\jruby-1.5.5\bin;C:\Program Files\Common Files\Shoes\0.r1514\..) 
Using rake (0.8.7) 
Using abstract (1.0.0) 
Using activesupport (3.0.3) 
Using builder (2.1.2) 
Using i18n (0.4.2) 
Using activemodel (3.0.3) 
Using erubis (2.6.6) 
Using rack (1.2.1) 
Using rack-mount (0.6.13) 
Using rack-test (0.5.6) 
Using tzinfo (0.3.23) 
Using actionpack (3.0.3) 
Using mime-types (1.16) 
Using polyglot (0.3.1) 
Using treetop (1.4.9) 
Using mail (2.2.10) 
Using actionmailer (3.0.3) 
Using arel (2.0.4) 
Using activerecord (3.0.3) 
Using activeresource (3.0.3) 
Using bcrypt-ruby (2.1.4) 
Using bundler (1.0.7) 
Using cancan (1.5.0) 
Using haml (3.0.24) 
Using compass (0.10.6) 
Using warden (1.0.3) 
Using devise (1.1.5) 
Installing hpricot (0.8.3) Temporarily enhancing PATH to include DevKit... 
with native extensions C:/ruby/Ruby187/lib/ruby/site_ruby/1.8/rubygems/installer.rb:483:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError) 

C:/ruby/Ruby187/bin/ruby.exe extconf.rb 
checking for stdio.h... no 
*** 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:/ruby/Ruby187/bin/ruby 


Gem files will remain installed in C:/ruby/Ruby187/lib/ruby/gems/1.8/gems/hpricot-0.8.3 for inspection. 
Results logged to C:/ruby/Ruby187/lib/ruby/gems/1.8/gems/hpricot-0.8.3/ext/fast_xs/gem_make.out 
     from C:/ruby/Ruby187/lib/ruby/site_ruby/1.8/rubygems/installer.rb:446:in `each' 
     from C:/ruby/Ruby187/lib/ruby/site_ruby/1.8/rubygems/installer.rb:446:in `build_extensions' 
     from C:/ruby/Ruby187/lib/ruby/site_ruby/1.8/rubygems/installer.rb:198:in `install' 
     from C:/ruby/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/source.rb:95:in `install' 
     from C:/ruby/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/installer.rb:55:in `run' 
     from C:/ruby/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:12:in `each' 
     from C:/ruby/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/spec_set.rb:12:in `each' 
     from C:/ruby/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/installer.rb:44:in `run' 
     from C:/ruby/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/installer.rb:8:in `install' 
     from C:/ruby/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/cli.rb:225:in `install' 
     from C:/ruby/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/task.rb:22:in `send' 
     from C:/ruby/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/task.rb:22:in `run' 
     from C:/ruby/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task' 
     from C:/ruby/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor.rb:246:in `dispatch' 
     from C:/ruby/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/vendor/thor/base.rb:389:in `start' 
     from C:/ruby/Ruby187/lib/ruby/gems/1.8/gems/bundler-1.0.7/bin/bundle:13 
     from C:/ruby/Ruby187/bin/bundle:19:in `load' 
     from C:/ruby/Ruby187/bin/bundle:19 
+0

你會得到什麼樣的錯誤? – theIV 2011-01-12 01:26:04

+0

@theIV,請參閱編輯問題 - 這裏沒有粘貼空間。 – konung 2011-01-12 15:49:33

回答

1

我們在捆綁器和Windows方面遇到了類似的問題,需要檢查的一點是特定版本可用於Windows和Linux/ruby​​本機系統。

首先在您的部署機器上安裝捆綁軟件包,然後將Gemfile.lock文件放到您的Windows開發框中也是一個好主意。

0

嘗試使用nokogiri。它與Hpricot非常相似,但主動維護且速度更快。

+0

我需要使用hpricot,因爲它是另一個庫(特別是haml scaffolding)的依賴項,否則我會堅持使用nokogiri。 – konung 2011-01-12 15:47:36

0

我不是捆綁軟件專家,遠不是「Ruby in Windows-land」專家,但僅僅通過做一點研究,您試圖在Gemfile中使用的platforms標誌似乎沒有有效。關於該主題,我能找到的唯一信息是在捆綁程序github頁面https://github.com/carlhuda/bundler/issues/issue/663上的以下問題。希望這可以幫助。

+0

theIV - 其實並不真實http://gembundler.com/man/gemfile.5.html。 Ctrl + F的平臺 – konung 2011-01-13 21:59:16