运行 捆绑安装时 Nokogiri v 1.8.1 问题
Nokogiri v 1.8.1 issue when running Bundle Install
当 运行 Bundle Install 或 Gem 安装 Nokogiri 时,我遇到了同样的问题,导致我的应用无法 运行。我怀疑这个问题是本地问题,是由于将所有内容都移到了 Rails 5,但我不确定。这是错误消息:
An error occurred while installing nokogiri (1.8.1), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.8.1'` succeeds before bundling.
In Gemfile:
rails_admin was resolved to 1.2.0, which depends on
rails was resolved to 5.1.3, which depends on
actioncable was resolved to 5.1.3, which depends on
actionpack was resolved to 5.1.3, which depends on
actionview was resolved to 5.1.3, which depends on
rails-dom-testing was resolved to 2.0.3, which depends on
nokogiri
(来自 运行 Bundle Install)
我尝试了 运行 Bundle Update 并使用了 Github 推荐的各种 Homebrew 命令,但我没有取得任何成功。
gem 安装 nokogiri -v '1.8.1'
1 error generated.
make[2]: *** [xmlIO.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
========================================================================
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Nokogiri 无法正常构建,因为您没有像 libxml2 这样的开发库。查看日志文件以查看发生了什么或尝试使用 brew install libxml2
直接安装 libxml2
请参阅 Nokogiry 在 http://www.nokogiri.org/tutorials/installing_nokogiri.html
提供的故障排除指南
(for UBUNTU) 首先尝试这样做
sudo apt-get install build-essential patch ruby-dev zlib1g-dev liblzmadev
然后尝试安装。
以下步骤可能会帮助您解决此问题:
gem update --system
安装Xcode命令行工具:xcode-select --install
现在终于安装 Nokogiri:gem install nokogiri
我升级后遇到了同样的问题Xcode
我不得不 运行: sudo xcode-select --switch /Library/Developer/CommandLineTools/
then: sudo bundle install --system
之后一切正常。
libxml2 和 zlib 是构建所必需的,您需要同时安装它们。
软呢帽:
sudo dnf install libxml2-devel zlib-devel
Ubuntu:
sudo apt install libxml2-dev zlib1g-dev
如果使用 MAC OS
你可以试试
brew unlink xz
gem install nokogiri
brew link xz
我用的是MACOS,用的是brew install ruby
,避免乱了系统的ruby环境,后面的bundle install
很顺利.
我只是发布我找到的解决方案(我在 MacOS 上遇到了同样的问题)。这样,gem将使用系统库安装,这应该可以解决您遇到的问题。
- 如果使用 gem:
gem install nokogiri -- --use-system-libraries
[--with-xml2-config=/path/to/xml2-config]
[--with-xslt-config=/path/to/xslt-config]
- 如果使用 捆绑包:
bundle config build.nokogiri --use-system-libraries
bundle install
在高山脉(和莫哈韦沙漠),这对我有用
gem install nokogiri -- --use-system-libraries=true --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/libxml2/
bundle update
bundle install
当 运行 Bundle Install 或 Gem 安装 Nokogiri 时,我遇到了同样的问题,导致我的应用无法 运行。我怀疑这个问题是本地问题,是由于将所有内容都移到了 Rails 5,但我不确定。这是错误消息:
An error occurred while installing nokogiri (1.8.1), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.8.1'` succeeds before bundling.
In Gemfile:
rails_admin was resolved to 1.2.0, which depends on
rails was resolved to 5.1.3, which depends on
actioncable was resolved to 5.1.3, which depends on
actionpack was resolved to 5.1.3, which depends on
actionview was resolved to 5.1.3, which depends on
rails-dom-testing was resolved to 2.0.3, which depends on
nokogiri
(来自 运行 Bundle Install) 我尝试了 运行 Bundle Update 并使用了 Github 推荐的各种 Homebrew 命令,但我没有取得任何成功。
gem 安装 nokogiri -v '1.8.1'
1 error generated.
make[2]: *** [xmlIO.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
========================================================================
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Nokogiri 无法正常构建,因为您没有像 libxml2 这样的开发库。查看日志文件以查看发生了什么或尝试使用 brew install libxml2
请参阅 Nokogiry 在 http://www.nokogiri.org/tutorials/installing_nokogiri.html
提供的故障排除指南(for UBUNTU) 首先尝试这样做
sudo apt-get install build-essential patch ruby-dev zlib1g-dev liblzmadev
然后尝试安装。
以下步骤可能会帮助您解决此问题:
gem update --system
安装Xcode命令行工具:
xcode-select --install
现在终于安装 Nokogiri:
gem install nokogiri
我升级后遇到了同样的问题Xcode
我不得不 运行: sudo xcode-select --switch /Library/Developer/CommandLineTools/
then: sudo bundle install --system
之后一切正常。
libxml2 和 zlib 是构建所必需的,您需要同时安装它们。
软呢帽:
sudo dnf install libxml2-devel zlib-devel
Ubuntu:
sudo apt install libxml2-dev zlib1g-dev
如果使用 MAC OS 你可以试试
brew unlink xz
gem install nokogiri
brew link xz
我用的是MACOS,用的是brew install ruby
,避免乱了系统的ruby环境,后面的bundle install
很顺利.
我只是发布我找到的解决方案(我在 MacOS 上遇到了同样的问题)。这样,gem将使用系统库安装,这应该可以解决您遇到的问题。
- 如果使用 gem:
gem install nokogiri -- --use-system-libraries
[--with-xml2-config=/path/to/xml2-config]
[--with-xslt-config=/path/to/xslt-config]
- 如果使用 捆绑包:
bundle config build.nokogiri --use-system-libraries
bundle install
在高山脉(和莫哈韦沙漠),这对我有用
gem install nokogiri -- --use-system-libraries=true --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/libxml2/
bundle update
bundle install