代码之家  ›  专栏  ›  技术社区  ›  Matt

如何告诉bundler使用已安装的mswin32版本的gem?

  •  2
  • Matt  · 技术社区  · 15 年前

    我做了:

    gem install hpricot --platform=mswin32
    

    gem list :

    *** LOCAL GEMS ***
    
    abstract (1.0.0)
    actionmailer (3.0.0)
    actionpack (3.0.0)
    activemodel (3.0.0)
    activerecord (3.0.0)
    activeresource (3.0.0)
    activesupport (3.0.0)
    arel (1.0.1)
    builder (2.1.2)
    bundler (1.0.0)
    columnize (0.3.1)
    erubis (2.6.6)
    hpricot (0.8.2 x86-mswin32)
    i18n (0.4.1)
    mail (2.2.6.1)
    mime-types (1.16)
    minitest (1.6.0)
    polyglot (0.3.1)
    rack (1.2.1)
    rack-mount (0.6.13)
    rack-test (0.5.6)
    rails (3.0.0)
    railties (3.0.0)
    rake (0.8.7)
    rd_searchlogic (3.0.0.rc3)
    rdoc (2.5.8)
    sqlite3-ruby (1.3.1 x86-mingw32)
    thor (0.14.2)
    treetop (1.4.8)
    tzinfo (0.3.23)
    

    但是 bundle install

    Installing hpricot (0.8.2) with native extensions C:/Documents and Settings/matt/.pik/rubies/Ruby-192dev-preview3-1/lib/ruby/site_ruby/1.9.1/rubygems/insta
    ller.rb:483:in `rescue in block in build_extensions': ERROR: Failed to build gem
     native extension. (Gem::Installer::ExtensionBuildError)
    

    如何告诉它使用mswin32?

    1 回复  |  直到 15 年前
        1
  •  2
  •   shingara    15 年前

    您只需要添加选项:platforms=>:mswin

    gem 'hpricot', :platforms => :mswin