安装 gems 时出错:无法加载此类文件 -- zlib
Error installing gems: cannot load such file -- zlib
我正在尝试在 Mac OS Yosmite
上安装捆绑器 gem
~/code/hello 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
- 升级Rubygems
- 重新安装 RVM 和 Ruby 2.2.2
- 切换到 Rbenv 和 Ruby 2.2.2
这真的让我头疼。Ruby 2.2.1 工作正常,但每当我尝试安装 gem.
时,2.2.2 就会导致这个问题
有人有什么想法吗?
尝试rvm pkg install zlib
(来自 this question)
RVM pkg 文档:https://rvm.io/packages
看起来 RVM 也有一种更新的管理包的方法,称为 autolibs
。检查 rvm autolibs show
,我希望它是 default(enabled)
,因为你刚刚安装了。如果不是,rvm autolibs enable
,或者您甚至可以通过 rvm autolibs homebrew
.
告诉它使用 Homebrew 而不是它自己的管理器
RVM 自动库文档:https://rvm.io/rvm/autolibs
以下对我有用:
brew install homebrew/dupes/zlib
rvm reinstall 2.2.2 --with-zlib-dir=/usr/local/Cellar/zlib/1.2.8
希望这对遇到它的其他人有所帮助。
我正在尝试在 Mac OS Yosmite
上安装捆绑器 gem~/code/hello 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
- 升级Rubygems
- 重新安装 RVM 和 Ruby 2.2.2
- 切换到 Rbenv 和 Ruby 2.2.2
这真的让我头疼。Ruby 2.2.1 工作正常,但每当我尝试安装 gem.
时,2.2.2 就会导致这个问题有人有什么想法吗?
尝试rvm pkg install zlib
(来自 this question)
RVM pkg 文档:https://rvm.io/packages
看起来 RVM 也有一种更新的管理包的方法,称为 autolibs
。检查 rvm autolibs show
,我希望它是 default(enabled)
,因为你刚刚安装了。如果不是,rvm autolibs enable
,或者您甚至可以通过 rvm autolibs homebrew
.
RVM 自动库文档:https://rvm.io/rvm/autolibs
以下对我有用:
brew install homebrew/dupes/zlib
rvm reinstall 2.2.2 --with-zlib-dir=/usr/local/Cellar/zlib/1.2.8
希望这对遇到它的其他人有所帮助。