如何在 Windows 上将 ruby​​gems 平台从 x86-mingw32 更改为 x86-mswin32-60

发布于 2024-09-09 21:43:15 字数 948 浏览 6 评论 0原文

我正在 Windows 中编写一些 ruby​​ 脚本,其中涉及打开和关闭浏览器。为此,我需要一些特殊的 gem 来连接本机 Windows 系统调用。但是当我尝试时

> gem install sys-proctable

,它产生了

ERROR: Could not find a valid gem ´sys-proctable´ (>= 0), here is why: 
          Found sys-proctable (0.9.0), but was for platforms x86-darwin-8 
            ,x86-freebsd-7 ,x86-solaris-2.10 ,x86-linux ,x86-mswin32-60

问题是我的gem安装没有x86-mswin32-60 ruby​​gems平台

> gem environment
RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.7
  - RUBY VERSION: 1.8.7 (2010-01-10 patchlevel 249) [i386-mingw32]

  ...

  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-mingw32

  ...

似乎问题来自于我用mingw库编译的ruby版本。所以我的问题是:如何获得 ruby​​ 版本,其中 ruby​​gems 平台包括 x86-mswin32-60?我在 ruby​​installer.org 中找不到任何非 mingw 的安装程序。

--- 编辑 ---

最后一部分有点仓促。实际上,rubyinstaller.org 拥有旧版一键安装程序,它们是为 mswin32 构建的。但该安装对我来说还有一些其他问题,所以我想我会尝试下面路易斯的解决方案。

I am doing some ruby scripting in windows, which involves opening and closing a browser. To that end I needed some special gems to interface to the native windows system calls. But when I tried

> gem install sys-proctable

, it yielded

ERROR: Could not find a valid gem ´sys-proctable´ (>= 0), here is why: 
          Found sys-proctable (0.9.0), but was for platforms x86-darwin-8 
            ,x86-freebsd-7 ,x86-solaris-2.10 ,x86-linux ,x86-mswin32-60

The problem is that my gem installation does not have the x86-mswin32-60 rubygems platform

> gem environment
RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.7
  - RUBY VERSION: 1.8.7 (2010-01-10 patchlevel 249) [i386-mingw32]

  ...

  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-mingw32

  ...

It seems that the problem comes from my version of ruby being compiled with mingw libraries. So my question is: how can I get a version of ruby, where rubygems platforms include x86-mswin32-60? I cannot find any installers from rubyinstaller.org which are not mingw.

--- edit ---

That last part was a bit hasty. Actually, rubyinstaller.org has the legacy one-click installers, which were built for mswin32. But that install had some other problems for me, so I guess I will try the solution from Luis below.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

请叫√我孤独 2024-09-16 21:43:15

您可以指定 --platform 选项强制安装 gem:

gem install sys-proctable --platform=x86-mswin32-60

但是,出于多种原因,我建议不要这样做,其中一些原因我在我的博客 此处

在将基于此的代码推送到生产环境。

希望有帮助。

You can force the gem installation specifying --platform option:

gem install sys-proctable --platform=x86-mswin32-60

However, I advise against it for several reasons, some I've mentioned in my blog here

Please test first and see if it will work before pushing a code that is based on this into a production environment.

Hope that helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文