zashii-1434

Stats of My Life(おいしい人生を味わうために、コツコツとチャレンジしたことを書くブログ)

Railsではまったこと(その1:nokogiri installエラー)

 

■事象

rake g controller xxを実行するとエラーが発生。どうやらGemがいけてないらしく

bundle installをすると次のようなエラーが発生

 

>An error occurred while installing nokogiri (1.6.8), and Bundler cannot

>continue.

>Make sure that `gem install nokogiri -v '1.6.8'` succeeds before bundling.

 

ちなみに、bundle installとは

「bundle install」を行なうと、「Gemfile」に書かれたGemパッケージと、そのGemパッケージが依存しているGemパッケージを自動的に調べて全てインストールしてくれます。「Gemfile.lock」はインストールされたGemパッケージの名前とバージョンが記録されたもの。

 

■調べたこと・やってみたこと

 

そもそもnokogiriって何?っていうところだったので調べてみるとどうやらスクレイピイングをする際に便利な機能がついているものらしい。

 

一度、nokogiriをアンインストールして再インストールしたものの変わらず。。。

いろいろググりながら試行錯誤して解決できたのが次の参考サイト。

 

qiita.com

 

やったことは

1.brew doctorを実行(インストールの問題をチェック)

$ brew doctor

 

2.libiconv でエラーがでていたので、指示の通り brew unlink をそれぞれ行いました。

$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

Warning: Some keg-only formula are linked into the Cellar.
Linking a keg-only formula, such as gettext, into the cellar with
`brew link <formula>` will cause other formulae to detect them during
the `./configure` step. This may cause problems when compiling those
other formulae.

Binaries provided by keg-only formulae may override system binaries
with other strange results.

You may wish to `brew unlink` these brews:
    homebrew/dupes/libiconv
    libxml2
    libxslt

 

結果、エラーが解決したものの、イマイチ根本原因がわかっていない状態。

時間があったら調べてみます。

 

一旦の共有でした。