ローカル環境では動いているnattoがherokuでは動きません。
チェックをしてもローカル環境と出てくるものが一緒なのでどこでミスをしているのかも把握できていない状態です。
どうかアドバイスをお願い致します。
調べて行った設定。
デプロイは出来てます。
bundleを使ってgem 'natto'を設定してます。
heroku config:set BUILDPACK_URL=https://github.com/diasks2/heroku-buildpack-mecab.git
heroku config:add LD_LIBRARY_PATH=app/.linuxbrew/lib
heroku config:set MECAB_PATH=app/.linuxbrew/lib/libmecab.so.2
公式のGithubをみて、どこに追記すればよいか分からなかったのでとりあえず、下の箇所に入れてみた。
//application.rb
class Application < Rails::Application
ENV['MECAB_PATH']='app/.linuxbrew/lib/libmecab.so.2'
Natto::MeCabError (Could not initialize Model with options: '--node-format=%f[7]')
heroku run rails c
読み込めてない??
Natto::MeCab.new
=> atto::MeCabError: Could not initialize Model with options: ''
Natto::MeCab.new('-F%f[7]')
=> Natto::MeCabError: Could not initialize Model with options: '--node-format=%f[7]'
ローカル rails c
こっちではNatto::MeCab.newはちゃんと動く。
Natto::MeCab.new
=> #<Natto::MeCab:0x00007f881000af10 @model...
ファイルチェックしてみました。
find /app/ -name *mecab*
/app/.linuxbrew/Cellar/mecab-ipadic
/app/.linuxbrew/Cellar/mecab-ipadic/2.7.0-20070801/lib/mecab
/app/.linuxbrew/Cellar/mecab-ipadic/2.7.0-20070801/.brew/mecab-ipadic.rb
/app/.linuxbrew/Cellar/mecab
/app/.linuxbrew/Cellar/mecab/0.996/share/man/man1/mecab.1
/app/.linuxbrew/Cellar/mecab/0.996/libexec/mecab
/app/.linuxbrew/Cellar/mecab/0.996/libexec/mecab/mecab-test-gen
/app/.linuxbrew/Cellar/mecab/0.996/libexec/mecab/mecab-dict-gen
/app/.linuxbrew/Cellar/mecab/0.996/libexec/mecab/mecab-system-eval
/app/.linuxbrew/Cellar/mecab/0.996/libexec/mecab/mecab-dict-index
/app/.linuxbrew/Cellar/mecab/0.996/libexec/mecab/mecab-cost-train
/app/.linuxbrew/Cellar/mecab/0.996/lib/libmecab.so
/app/.linuxbrew/Cellar/mecab/0.996/lib/libmecab.so.2.0.0
/app/.linuxbrew/Cellar/mecab/0.996/lib/libmecab.a
/app/.linuxbrew/Cellar/mecab/0.996/lib/libmecab.so.2
/app/.linuxbrew/Cellar/mecab/0.996/.brew/mecab.rb
/app/.linuxbrew/Cellar/mecab/0.996/include/mecab.h
/app/.linuxbrew/Cellar/mecab/0.996/bin/mecab
/app/.linuxbrew/Cellar/mecab/0.996/bin/mecab-config
/app/.linuxbrew/Library/Taps/homebrew/homebrew-core/Formula/mecab-ko.rb
/app/.linuxbrew/Library/Taps/homebrew/homebrew-core/Formula/mecab-ipadic.rb
/app/.linuxbrew/Library/Taps/homebrew/homebrew-core/Formula/mecab-ko-dic.rb
/app/.linuxbrew/Library/Taps/homebrew/homebrew-core/Formula/mecab.rb
/app/.linuxbrew/Library/Taps/homebrew/homebrew-core/Formula/mecab-jumandic.rb
/app/.linuxbrew/Library/Taps/homebrew/homebrew-core/Formula/mecab-unidic.rb
/app/.linuxbrew/Library/Taps/homebrew/homebrew-core/Formula/mecab-unidic-extended.rb
/app/.linuxbrew/share/man/man1/mecab.1
/app/.linuxbrew/var/homebrew/locks/mecab.formula.lock
/app/.linuxbrew/var/homebrew/locks/a3da242228cf276ea0b7776960145ae549f7ff3985e0ea873d7c145f4fbf9650--mecab-ipadic-2.7.0-20070801.x86_64_linux.bottle.tar.gz.incomplete.lock
/app/.linuxbrew/var/homebrew/linked/mecab-ipadic
/app/.linuxbrew/var/homebrew/linked/mecab
/app/.linuxbrew/etc/mecabrc
/app/.linuxbrew/lib/libmecab.so
/app/.linuxbrew/lib/libmecab.so.2.0.0
/app/.linuxbrew/lib/mecab
/app/.linuxbrew/lib/libmecab.a
/app/.linuxbrew/lib/libmecab.so.2
/app/.linuxbrew/include/mecab.h
/app/.linuxbrew/bin/mecab
/app/.linuxbrew/bin/mecab-config
/app/.linuxbrew/opt/mecab-ipadic
/app/.linuxbrew/opt/mecab
/app/app/.linuxbrew/lib/libmecab.so.2
-
気になる質問をクリップする
クリップした質問は、後からいつでもマイページで確認できます。
またクリップした質問に回答があった際、通知やメールを受け取ることができます。
クリップを取り消します
-
良い質問の評価を上げる
以下のような質問は評価を上げましょう
- 質問内容が明確
- 自分も答えを知りたい
- 質問者以外のユーザにも役立つ
評価が高い質問は、TOPページの「注目」タブのフィードに表示されやすくなります。
質問の評価を上げたことを取り消します
-
評価を下げられる数の上限に達しました
評価を下げることができません
- 1日5回まで評価を下げられます
- 1日に1ユーザに対して2回まで評価を下げられます
質問の評価を下げる
teratailでは下記のような質問を「具体的に困っていることがない質問」、「サイトポリシーに違反する質問」と定義し、推奨していません。
- プログラミングに関係のない質問
- やってほしいことだけを記載した丸投げの質問
- 問題・課題が含まれていない質問
- 意図的に内容が抹消された質問
- 過去に投稿した質問と同じ内容の質問
- 広告と受け取られるような投稿
評価が下がると、TOPページの「アクティブ」「注目」タブのフィードに表示されにくくなります。
質問の評価を下げたことを取り消します
この機能は開放されていません
評価を下げる条件を満たしてません
質問の評価を下げる機能の利用条件
この機能を利用するためには、以下の事項を行う必要があります。
- 質問回答など一定の行動
-
メールアドレスの認証
メールアドレスの認証
-
質問評価に関するヘルプページの閲覧
質問評価に関するヘルプページの閲覧
15分調べてもわからないことは、teratailで質問しよう!
- ただいまの回答率 88.36%
- 質問をまとめることで、思考を整理して素早く解決
- テンプレート機能で、簡単に質問をまとめられる