【问题标题】:Having trouble installing gem "termios" after trying to update Rails尝试更新 Rails 后无法安装 gem“termios”
【发布时间】:2014-07-28 09:35:45
【问题描述】:

我正在尝试将 Rails 从 3.1.3 更新到 3.2.8。更改 rails gem 值并运行“bundle update rails”会尝试安装名为“termios”版本 0.9.4 的 gem,但失败并显示以下消息:

Installing termios (0.9.4) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /Users/me/.rvm/rubies/ruby-1.9.3-p0/bin/ruby extconf.rb 
checking for termios.h... yes
checking for unistd.h... yes
creating Makefile

make
compiling termios.c
In file included from termios.c:10:
/Users/me/.rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/ruby/backward/rubyio.h:2:2:     warning: #warning use "ruby/io.h" instead of "rubyio.h"
termios.c: In function ‘Termios_to_termios’:
termios.c:182: error: ‘struct RArray’ has no member named ‘ptr’
termios.c:183: error: ‘struct RArray’ has no member named ‘ptr’
termios.c: In function ‘termios_tcgetattr’:
termios.c:200: error: ‘OpenFile’ undeclared (first use in this function)
make: *** [termios.o] Error 1

Gem files will remain installed in /Users/me/.rvm/gems/ruby-1.9.3-p0@mcp5/gems/termios-0.9.4 for inspection.
Results logged to /Users/me/.rvm/gems/ruby-1.9.3-p0@mcp5/gems/termios-0.9.4/./gem_make.out
An error occured while installing termios (0.9.4), and Bundler cannot continue.
Make sure that `gem install termios -v '0.9.4'` succeeds before bundling.

另请注意,这是我使用 OS X Mountain Lion 后第一次更新 Rails。

我已经看到关于这个问题的另一个答案,它说要安装一个名为“ruby-termios”的gem。我这样做了,那个 gem 安装得很好,但是在某个地方仍然有一个依赖项试图安装“termios”gem。

【问题讨论】:

  • 升级到山狮后你还能跑铁轨吗?
  • 是的。我不得不重新安装 gcc 并做一些其他的 mods。正在使用rvm,还必须重新安装ruby 1.9.3。然后使用 brew 重新安装 ImageMagick。
  • 很好,这样做为我解决了制作问题。

标签: ruby-on-rails rubygems bundler


【解决方案1】:

我最终将ruby-termios gem 克隆到我的存储库中。出于某种未知的原因,作者将其命名为 ruby​​-termios 而不仅仅是 termios。所以我重命名了gemspec。然后我修改了我的 Gemfile 以使用:

gem 'termios', :path => 'termios'

然后我跑了:

bundle update

一切都恢复正常了。

【讨论】:

  • 我听从了你的建议。所以也可以是:gem 'termios', git: 'git://github.com/edison/ruby-termios.git'
  • 太棒了。我还不够聪明,没想到!
【解决方案2】:

似乎在您的 Gemfile 中指定 gem 'engineyard' 会导致 bundler 安装一些具有 termios 依赖项的古老版本(0.2.x)。

指定一个较新的 (gem 'engineyard', '~> 2.3') 将正确安装。

【讨论】:

    【解决方案3】:

    gem install ruby-termios 为我解决了制作问题;我希望您的 Gemfile 中的 gem "ruby-termios" 也能正常工作。

    看起来发生的事情是,名为 termios (arika) 的 gem 的原始作者自 2004 年 (v 0.9.4) 以来没有更新 gem,但没有人拥有 ruby​​gems http://rubygems.org/gems/termios 上的命名空间。然后其他人(爱迪生)在 github https://github.com/edison/ruby-termios 上做了一个 fork,还有一个人else(tylerrick)推了一个名为 ruby-termios 的新 gem...但是当然在 Ruby 内部,这个库仍然被命名termios 所以命令仍然是require "termios"

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-04-25
      • 1970-01-01
      • 2019-09-09
      • 1970-01-01
      • 2012-05-31
      • 2012-03-28
      • 1970-01-01
      相关资源
      最近更新 更多