Windows 上的 Gem 更新 - 是否损坏? [英] Gem update on Windows - is it broken?

查看:20
本文介绍了Windows 上的 Gem 更新 - 是否损坏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是 这个问题的后续行动.

当我在 Windows 上发出 gem update 命令时,每当它到达gem 的最新版本没有 Windows 二进制文件,它会尝试构建本机扩展,这当然会失败.例如:

When I issue the gem update command on Windows, whenever it gets to a gem whose latest version DOESN'T have Windows binaries, it'll attempt to build the native extension which will, of course, fail. For example:

Updating sqlite3-ruby
Building native extensions.  This could take a while...
ERROR:  While executing gem ... (Gem::Installer::ExtensionBuildError)
  ERROR: Failed to build gem native extension.

c:/ruby/bin/ruby.exe extconf.rb update
checking for fdatasync() in rt.lib... no
checking for sqlite3.h... no

nmake
'nmake' is not recognized as an internal or external command,
operable program or batch file.

至少要求所需平台的旧的 pre-1.x 行为使更新成为可能.现在我根本无法更新,除非我卸载麻烦的 gem(目前是 sqlite3-ruby 和 hpricot),运行更新,然后使用 --version 开关重新安装 gem.

The old pre-1.x behavior of asking for the required platform at least made updating possible. Now I can't update at all unless I uninstall the troublesome gems (currently sqlite3-ruby and hpricot), run the update, then re-install the gems using the --version switch.

有没有人能解决这个难题,还是我们被困住了?

Does anyone have a solution to this conundrum or are we stuck with it?

注意:

$ gem -v
1.2.0

$ ruby -v
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]

<小时>

注意(2008 年 9 月 26 日):我刚刚更新到 gems 1.3.0,这个问题仍然存在.


Note (26 September 2008): I just updated to gems 1.3.0 and this problem persists.

注意(2008 年 11 月 18 日):刚刚更新到 gems 1.3.1,问题仍然存在.

Note (18 November 2008): Just updated to gems 1.3.1 and the problem persists.

注意(2009 年 4 月 28 日): Gems 的最新版本(1.3.2) 现在跳过在更新期间构建原生扩展失败的任何 gem;换句话说,问题是固定的.万岁!

Note (28 April 2009): The latest version of Gems (1.3.2) now skips any gems where building of native extensions fails during update; in other words, the problem is fixed. Hooray!

推荐答案

Gems,截至 version 1.3.2,现在会跳过构建失败的gem,所以将Rubygems更新到最新版本,这里讨论的问题应该就解决了.

Gems, as of version 1.3.2, will now skip gems that fail to build, so update Rubygems to the latest version and the problem discussed here should be solved.

gem update --system

以下解决方案现已弃用,但我将其留在这里记录.

我在 Ruby 论坛上在这个问题上发起了一个帖子(这是一个前沿结束邮件列表).有一些有趣的讨论;值得一读.那里甚至有一个非常hacky的解决方案:

I started a thread on this issue on the Ruby Forum (it's a front end to the mailing list). There's some interesting discussion; it's worth a read. There's even a very hacky solution to this problem on there:

`gem.bat outdated`.split(/
/).map{|z|z.scan(/^[^[:space:]]+/)}.flatten.each{|z| `gem.bat update #{z}`}

它调用 gem outdated 命令并构建所有过时 gem 的列表.然后它遍历列表并为每个单独的过时 gem 调用 gem update.如果一个失败,它就会转移到下一个.

It calls the gem outdated command and builds a list of all of the outdated gems. It then iterates over the list and calls gem update for each individual outdated gem. If one fails, it just moves onto the next.

这篇关于Windows 上的 Gem 更新 - 是否损坏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆