我正在通过rbenv设置一台运行Mac OS 10.8和Ruby 1.9.3的新机器。
经过许多试探性的开始,并阅读了许多堆栈溢出的答案,我能够使用以下方法安装Nokogiri:
sudo gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.8.0/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.8.0/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.28 --with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib
Building native extensions. This could take a while...
Successfully installed nokogiri-1.5.6
1 gem installed
现在我正在尝试捆绑一个Rails应用程序,但我无法安装Nokogiri。我总是收到缺少libxml2的错误。
我尝试的最后一个命令是:
bundle config build.nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.8.0/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.8.0/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.28 --with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib
bundle install
有谁知道如何解决这个问题?
您是否尝试过更新的自制软件安装说明?FWIW,我从来没有遇到过MacPorts的问题
在你的配置命令中不需要 -- 。请参阅捆绑包配置页面。我知道这个问题很老了,但也许其他人可以从中受益。
bundle config build.nokogiri --with-xml2-include=/usr/local/Cellar/libxml2/2.8.0/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.8.0/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.28 --with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib
bundle install
您可以检查您的 ~/.bundle/config 文件以查看配置是否正确记录。
我也刚刚将此错误提交给捆绑器。如果您在构建时遇到Syntax error: Unterminated quoted string
,请查看它。