我见过 Guard 以及它在 Web 开发中的实用性,因此想安装它。当然,我希望能够使用它sudo gem install guard
来做到这一点(是的,它是一个 Ruby Gem)。但是安装出错了。以下是我得到的结果:
Building native extensions. This could take a while...
ERROR: Error installing guard:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:4:in `<main>'
Gem files will remain installed in /var/lib/gems/1.9.1/gems/ffi-1.9.3 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/ffi-1.9.3/ext/ffi_c/gem_make.out
有人知道我该如何解决这个问题吗?谢谢您的帮助。
答案1
我找到了问题所在。查看错误后,我意识到问题在于未安装 mkmf。为了修复此问题,我运行了命令。sudo apt-get install ruby1.9.1-dev
之后,一切都运行正常。
答案2
通过 Mozilla 下载 Guard 然后安装。选项 2. 尝试再次更新sudo apt-get update
然后sudo apt-gem-update
然后尝试sudo gem-get install guard
(或sudo gem install guard
)