LoginSignup
5
3

More than 5 years have passed since last update.

MacOS Sierra で nokogiri-1.7.1のインストールに失敗

Posted at

エラー発生

Rails new したら、

$rails new hoge
 .
 .
 .
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
 .
 .
 .
xmlIO.c:1450:52: error: use of undeclared identifier 'LZMA_OK'
    ret =  (__libxml2_xzclose((xzFile) context) == LZMA_OK ) ? 0 : -1;
                                                   ^
1 error generated.
make[2]: *** [xmlIO.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
========================================================================
*** extconf.rb failed ***
 .
 .
 .
An error occurred while installing nokogiri (1.7.1), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.7.1'` succeeds before bundling.
         run  bundle exec spring binstub --all
* bin/rake: spring inserted
* bin/rails: spring inserted
$

こんなんでました。nokogiriのバージョンが新しくなってインストールしてみたけど失敗したらしい。
色々やって。

結論

$brew unlink xz
$gem install nokogiri -v '1.7.1'

ののちに

$rails new hoge

で成功。

環境

MacOS Sierra
rails 5.0.2

5
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
3