如何在 Windows 上将 rubygems 平台从 x86-mingw32 更改为 x86-mswin32-60
我正在 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 rubygems平台
> 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 版本,其中 rubygems 平台包括 x86-mswin32-60?我在 rubyinstaller.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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以指定
--platform
选项强制安装 gem:但是,出于多种原因,我建议不要这样做,其中一些原因我在我的博客 此处
在将基于此的代码推送到生产环境。
希望有帮助。
You can force the gem installation specifying
--platform
option: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.