【问题标题】:Bundler doesn't want to install hpricot on Windows XP with Ruby 1.8.7Bundler 不想在带有 Ruby 1.8.7 的 Windows XP 上安装 hpricot
【发布时间】:2011-01-11 23:23:05
【问题描述】:

我在 Windows 机器上开发,但部署到 Debian。尝试将 hpricot 与 Rails 3 应用程序一起使用。我可以使用以下方式安装 gem:

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

这是来自 stackoverflow 上的另一个问题 - 但它对我不起作用。

有什么想法吗?

附:

Windows XP sp3 和 Ruby 1.8.7 和 Rails 3.0.3 和 bundler 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

【问题讨论】:

  • 你得到什么样的错误?
  • @theIV,请参阅问题中的编辑 - 这里没有空间可以粘贴。

标签: ruby-on-rails windows bundle bundler hpricot


【解决方案1】:

我们在使用 bundler 和 Windows 时遇到过类似的问题,需要检查的一件事是特定版本是否适用于 Windows 和 Linux/ruby 本机系统。

首先在您的部署机器上进行捆绑安装可能也是一个好主意,然后将 Gemfile.lock 文件带到您的 Windows 开发框。

【讨论】:

    【解决方案2】:

    尝试使用nokogiri。它与 Hpricot 非常相似,但得到积极维护并且速度更快。

    【讨论】:

    • 我需要使用 hpricot,因为它是另一个库中的依赖项(特别是用于设计的 haml 脚手架),否则我会坚持使用 nokogiri。
    【解决方案3】:

    我不是打包专家,也远不是“Windows 领域的 Ruby”专家,但只是做了一点研究,您尝试在 Gemfile 中使用的 platforms 标志似乎并不有效。我能找到的关于该主题的唯一信息是捆绑器 github 页面 https://github.com/carlhuda/bundler/issues/issue/663 上的以下问题。希望这会有所帮助。

    【讨论】:

    • theIV - 实际上不是真的 gembundler.com/man/gemfile.5.html 。 Ctrl+F 用于平台
    • @Nick Gorbikoff 感谢您教给我一些我不知道的东西 :)
    • 我从 github 上的问题了解到,这是从 0.9 版开始添加的。但我可能错了。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-28
    • 2011-01-26
    相关资源
    最近更新 更多