试图让克隆的Rails应用程序运行。运行bundle install
时出现此错误:
Using mini_portile (0.5.0)
Installing nokogiri (1.6.0)
Gem::InstallError: nokogiri requires Ruby version >= 1.9.2.
An error occurred while installing nokogiri (1.6.0), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.0'` succeeds before bundling.
但这是rbenv version
的输出:
› rbenv version
1.9.3-p429 (set by /Users/andrewguo/.rbenv/version)
当运行gem list
时,我得到:
.
.
.
mini_portile (0.5.0)
minitest (2.5.1)
multi_json (1.7.7)
nokogiri (1.6.0)
我已经绞尽脑汁一小时了,现在试图找出可能出错的地方......请帮忙!
编辑:
这是一个更详细的错误输出:
An error occurred while installing nokogiri (1.6.0), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.0'` succeeds before bundling.
Bundler::InstallError: An error occurred while installing nokogiri (1.6.0), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.0'` succeeds before bundling.
/Library/Ruby/Gems/1.8/gems/bundler-1.3.5/lib/bundler/installer.rb:130:in `install_gem_from_spec'
/Library/Ruby/Gems/1.8/gems/bundler-1.3.5/lib/bundler/installer.rb:91:in `run'
/Library/Ruby/Gems/1.8/gems/bundler-1.3.5/lib/bundler/installer.rb:90:in `run'
/Library/Ruby/Gems/1.8/gems/bundler-1.3.5/lib/bundler/installer.rb:14:in `install'
/Library/Ruby/Gems/1.8/gems/bundler-1.3.5/lib/bundler/cli.rb:247:in `install'
/Library/Ruby/Gems/1.8/gems/bundler-1.3.5/lib/bundler/vendor/thor/task.rb:27:in `__send__'
/Library/Ruby/Gems/1.8/gems/bundler-1.3.5/lib/bundler/vendor/thor/task.rb:27:in `run'
/Library/Ruby/Gems/1.8/gems/bundler-1.3.5/lib/bundler/vendor/thor/invocation.rb:120:in `invoke_task'
/Library/Ruby/Gems/1.8/gems/bundler-1.3.5/lib/bundler/vendor/thor.rb:344:in `dispatch'
/Library/Ruby/Gems/1.8/gems/bundler-1.3.5/lib/bundler/vendor/thor/base.rb:434:in `start'
/Library/Ruby/Gems/1.8/gems/bundler-1.3.5/bin/bundle:20
/Library/Ruby/Gems/1.8/gems/bundler-1.3.5/lib/bundler/friendly_errors.rb:3:in `with_friendly_errors'
/Library/Ruby/Gems/1.8/gems/bundler-1.3.5/bin/bundle:20
/usr/bin/bundle:19:in `load'
/usr/bin/bundle:19
我正在使用Mac OSX(El Capitan),它似乎与Xcode Developer Tools有关。我在我的工作目录中运行xcode-select --install
,然后重新启动bundle install
命令,在^^之后它都运行良好。
希望这可以帮助某人。
我遇到了这个错误,这对我有用:
bundle config build.nokogiri --use-system-libraries
bundle install
问题出在libxml
:
libxml2 is missing. Please locate mkmf.log to investigate how it is failing.
原来我使用的是默认系统Ruby(因此在/Library/Ruby/Gems
安装了所有宝石),尽管rbenv指向ruby-1.9.3,这就是Nokogiri抱怨的原因。
通过将此添加到$ PATH来修复此问题,因此rbenv在系统ruby之前加载:
export PATH="$HOME/.rbenv/bin:$PATH"
确保您拥有最新版本的命令行工具。如果你不确定只运行xcode-select --install
,这将弹出一个很好的gui来指导你完成安装过程。您也可以检查mac app store以查看是否有等待您的更新。目前的版本是Command Line Developer Tool for OS X 10.10
,所以你可以看看Yosemite是否没有问题。获得更新后,运行sudo bundle install
,您可以拥有最新版本的nokogiri。祝好运。
尝试使用旧版本的nokogiri,它对我有用
'M'看到','1。5. 9'
如果googler的同事正在使用linux(ubuntu),那么安装deb包zlib1g-dev有帮助
以下对我有用:
gem install nokogiri -- --use-system-libraries
使用以下命令安装旧版本:gem install nokogiri -v 1.5.5
您只需要在macOS中安装Homebrew
在终端/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
上运行