【发布时间】:2015-07-06 01:33:24
【问题描述】:
在我试图为这个其他问题找到解决方案时,我感到很沮丧,只是用rm -rf ~/.rbenv/versions/2.2.2 删除了我的 Ruby 安装。使用rbenv install 2.2.2 重新安装它后,我发现突然无法安装bundler gem。 gem install bundler 命令导致以下错误:
ERROR: Loading command: install (LoadError)
cannot load such file -- zlib
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
我所读到的一切似乎都表明缺少zlib 包通常是Linux 系统的问题。但是,我使用的是 OSX 10.10.4,并且我读过 zlib 应该带有我拥有的命令行工具。
经过一堆谷歌搜索但没有任何进展,我决定从 rbenv 重新开始。我卸载了 rbenv 并重新安装了它,但我仍然无法使用我的 rbenv 安装的 ruby 2.2.2 来安装 bundler。而且,我发现我根本无法安装 2.2.0 或 2.2.1 版本:
MacBook-Pro:~ me$ rbenv install 2.2.0
Downloading ruby-2.2.0.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/7671e394abfb5d262fbcd3b27a71bf78737c7e9347fa21c39e58b0bb9c4840fc
Installing ruby-2.2.0...
BUILD FAILED (OS X 10.10.4 using ruby-build 20150519)
Inspect or clean up the working tree at /var/folders/rm/38vbv5g952s54r1txrmrdlf40000gn/T/ruby-build.20150705212307.49958
Results logged to /var/folders/rm/38vbv5g952s54r1txrmrdlf40000gn/T/ruby-build.20150705212307.49958.log
Last 10 log lines:
from /private/var/folders/rm/38vbv5g952s54r1txrmrdlf40000gn/T/ruby-build.20150705212307.49958/ruby-2.2.0/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
from /private/var/folders/rm/38vbv5g952s54r1txrmrdlf40000gn/T/ruby-build.20150705212307.49958/ruby-2.2.0/lib/rubygems.rb:556:in `install'
from ./tool/rbinstall.rb:717:in `block (2 levels) in <main>'
from ./tool/rbinstall.rb:716:in `each'
from ./tool/rbinstall.rb:716:in `block in <main>'
from ./tool/rbinstall.rb:749:in `call'
from ./tool/rbinstall.rb:749:in `block in <main>'
from ./tool/rbinstall.rb:746:in `each'
from ./tool/rbinstall.rb:746:in `<main>'
make: *** [do-install-all] Error 1
我完全没有想法,如果有人认为他们可能知道发生了什么,我将不胜感激。在这一点上,我的开发环境几乎完全被淹没了。
编辑
运行brew doctor的输出:
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!
Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected dylibs:
/usr/local/lib/libatk-1.0.0.2209.1.dylib
/usr/local/lib/libgdk-x11-2.0.0.1200.0.dylib
/usr/local/lib/libgdk_pixbuf-2.0.0.1200.0.dylib
/usr/local/lib/libgdk_pixbuf_xlib-2.0.0.1200.0.dylib
/usr/local/lib/libgio-2.0.0.0.0.dylib
/usr/local/lib/libGLEW.1.5.4.dylib
/usr/local/lib/libglib-2.0.0.1600.0.dylib
/usr/local/lib/libgmodule-2.0.0.1600.0.dylib
/usr/local/lib/libgobject-2.0.0.1600.0.dylib
/usr/local/lib/libgthread-2.0.0.1600.0.dylib
/usr/local/lib/libgtk-x11-2.0.0.1200.0.dylib
/usr/local/lib/libintl.8.0.2.dylib
/usr/local/lib/libjpeg.62.dylib
/usr/local/lib/libpango-1.0.0.2100.0.dylib
/usr/local/lib/libpangocairo-1.0.0.2100.0.dylib
/usr/local/lib/libpangoft2-1.0.0.2100.0.dylib
/usr/local/lib/libpangox-1.0.0.2100.0.dylib
/usr/local/lib/libpangoxft-1.0.0.2100.0.dylib
/usr/local/lib/libportaudio.2.0.0.dylib
/usr/local/lib/libSDL-1.2.0.dylib
/usr/local/lib/libz.1.2.5.dylib
Warning: Unbrewed .la files were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected .la files:
/usr/local/lib/libatk-1.0.la
/usr/local/lib/libgdk-x11-2.0.la
/usr/local/lib/libgdk_pixbuf-2.0.la
/usr/local/lib/libgdk_pixbuf_xlib-2.0.la
/usr/local/lib/libgio-2.0.la
/usr/local/lib/libglib-2.0.la
/usr/local/lib/libgmodule-2.0.la
/usr/local/lib/libgobject-2.0.la
/usr/local/lib/libgthread-2.0.la
/usr/local/lib/libgtk-x11-2.0.la
/usr/local/lib/libintl.la
/usr/local/lib/libjpeg.la
/usr/local/lib/libpango-1.0.la
/usr/local/lib/libpangocairo-1.0.la
/usr/local/lib/libpangoft2-1.0.la
/usr/local/lib/libpangox-1.0.la
/usr/local/lib/libpangoxft-1.0.la
/usr/local/lib/libportaudio.la
Warning: Unbrewed static libraries were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected static libraries:
/usr/local/lib/libintl.a
/usr/local/lib/libjpeg.a
/usr/local/lib/libportaudio.a
/usr/local/lib/libz.a
【问题讨论】:
-
你也在使用自制软件吗?如果是这样,您可以尝试运行
brew doctor。 -
感谢您的评论@MattBrictson。是的,我一直在使用自制软件来安装/卸载 rbenv 和 ruby-build。我在运行
brew doctor时收到一些警告,但它看起来不像我以前从未见过的任何东西。我会将完整的输出添加到我的帖子中。 -
嗯,我以前没见过那些
brew doctor警告。也许尝试将libz*文件移出/usr/local/lib看看是否能解决问题? -
原来它与我的 Xcode 安装有关。我已经在下面发布了答案
标签: ruby-on-rails ruby macos bundler rbenv