我最近对 Mountain Lion 进行了全新安装,在安装 Nokogiri 之后 - 启动 Rails 控制台时出现错误:
WARNING: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.7.8
所以我在这里查看了其他问题,并卸载了所有内容并再次尝试,但我注意到 Nokogiri 网站上的安装说明已过时:http: //nokogiri.org/tutorials/installing_nokogiri.html
因为“brew install libxml2 libxslt”实际上安装了 libxml2 2.8.0,并进一步阅读它引用 2.7.8 的说明:
gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.7.8/include/libxml2
--with-xml2-lib=/usr/local/Cellar/libxml2/2.7.8/lib
--with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26
--with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include
--with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib
(注意 libxml2/2.7.8)
所以我再次卸载,并重新安装:(libxml2/2.8.0)
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.26 --with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib
虽然它似乎在 IRB 中运行良好,但在 Rails C 中却不行——它仍然说:
WARNING: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.7.8
我试过运行捆绑更新,但它仍然是一样的。
请问有什么办法可以解决这个问题吗?