LoginSignup
0
0

More than 3 years have passed since last update.

railsコマンドを叩くと「Ignoring nokogiri~」が大量に吐き出された話。

Last updated at Posted at 2021-01-01

rails g model でmodelを作成しようとしたところ
Ignoring nokogiri-1.10.0 because~ という1文が大量に吐き出された。どうも気持ち悪いかつ上手くmodelの生成が出来ず詰まってしまったのでメモ。

(結論言うとmodelが作成できないのは別の理由だったのでIgnore~の部分について言及していく。)

image.png

やったこと

アラートに書かれている通り gem pristine nokogiri --version 1.10.9 を実施。すると

ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.

なにやらPermission Errorが出てきて上手くgemが入らない。

一難去ってまた一難

bundle installしてもpermissionsエラーが起きるときの対処法という記事にたどり着き、事なきを得るかと思いきや最後の

gem install bundler

を実行したところ今度は

ERROR:  Loading command: install (LoadError)
    dlopen(/Users/zenichiro0419/.rbenv/versions/2.6.2/lib/ruby/2.6.0/x86_64-darwin16/openssl.bundle, 9): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
  Referenced from: /Users/zenichiro0419/.rbenv/versions/2.6.2/lib/ruby/2.6.0/x86_64-darwin16/openssl.bundle
  Reason: image not found - /Users/zenichiro0419/.rbenv/versions/2.6.2/lib/ruby/2.6.0/x86_64-darwin16/openssl.bundle
ERROR:  While executing gem ... (NoMethodError)
    undefined method `invoke_with_build_args' for nil:NilClass

結果rbenvの再インストールが肝だった。

gem コマンドで Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib が出たときの対処法 で紹介されている通り、ライブラリの構成が何かが原因でおかしくなっていたようなので rbenvの再インストールを行った。

まとめると

# rbenvのアンインストール
$ rbenv uninstall 2.6.3

# rbenvのインストール
$ rbenv install 2.6.3

# bundlerのインストール
$ gem install bundler

# rbenvのリフレッシュ
$ rbenv rehash

# gemのインストール
$ bundle install 

install画面でさっきの「nokogiri~」というのが見えたかつrailsのコマンドを叩いて Ignoring nokogiri-1.10.0 because~ が見えなくなった(追記:rehashは不要の説もありと情報いただきました。)。解決。

終わりに

個人でアプリ開発を行っているわけだが環境構築から開発着手まで半年近く期間が空いたからかなかなか立ち上げの部分で詰まらない部分で足踏みしてしまっている。これからアプリ開発をやり始めようとしている私のような駆け出しの方がいたら環境構築から開発着手までは一気通貫してやることを勧める。

おまけ

rails g 出来ないときは spring stopを叩こうこちらの記事でも書かれているのだが、どうも治らず。

検索してもエラー文が Could not find generator 'hoge' なので上記リンク先のような情報しか出てこずお手上げ状態だったのだが・・・なんと自分の場合はrails g modal とまさかのタイポだった。。気づくまでにだいぶ時間を要してしまった。

エラー文を読むことも大事だが、自分が叩いたコマンドにも気をつけよう。。

0
0
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
0
0