質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Ruby on Rails 5

Ruby on Rails 5は、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Q&A

解決済

1回答

2823閲覧

heroku でnattoを使用したい。

shuzi

総合スコア197

Ruby on Rails 5

Ruby on Rails 5は、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

0グッド

0クリップ

投稿2019/06/06 03:19

編集2019/06/06 04:11

ローカル環境では動いている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をみて、どこに追記すればよいか分からなかったのでとりあえず、下の箇所に入れてみた。

config

1//application.rb 2class Application < Rails::Application 3 ENV['MECAB_PATH']='app/.linuxbrew/lib/libmecab.so.2'

heroku

1Natto::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はちゃんと動く。

ruby

1Natto::MeCab.new 2=> #<Natto::MeCab:0x00007f881000af10 @model...

ファイルチェックしてみました。
find /app/ -name mecab

heroku

1/app/.linuxbrew/Cellar/mecab-ipadic 2/app/.linuxbrew/Cellar/mecab-ipadic/2.7.0-20070801/lib/mecab 3/app/.linuxbrew/Cellar/mecab-ipadic/2.7.0-20070801/.brew/mecab-ipadic.rb 4/app/.linuxbrew/Cellar/mecab 5/app/.linuxbrew/Cellar/mecab/0.996/share/man/man1/mecab.1 6/app/.linuxbrew/Cellar/mecab/0.996/libexec/mecab 7/app/.linuxbrew/Cellar/mecab/0.996/libexec/mecab/mecab-test-gen 8/app/.linuxbrew/Cellar/mecab/0.996/libexec/mecab/mecab-dict-gen 9/app/.linuxbrew/Cellar/mecab/0.996/libexec/mecab/mecab-system-eval 10/app/.linuxbrew/Cellar/mecab/0.996/libexec/mecab/mecab-dict-index 11/app/.linuxbrew/Cellar/mecab/0.996/libexec/mecab/mecab-cost-train 12/app/.linuxbrew/Cellar/mecab/0.996/lib/libmecab.so 13/app/.linuxbrew/Cellar/mecab/0.996/lib/libmecab.so.2.0.0 14/app/.linuxbrew/Cellar/mecab/0.996/lib/libmecab.a 15/app/.linuxbrew/Cellar/mecab/0.996/lib/libmecab.so.2 16/app/.linuxbrew/Cellar/mecab/0.996/.brew/mecab.rb 17/app/.linuxbrew/Cellar/mecab/0.996/include/mecab.h 18/app/.linuxbrew/Cellar/mecab/0.996/bin/mecab 19/app/.linuxbrew/Cellar/mecab/0.996/bin/mecab-config 20/app/.linuxbrew/Library/Taps/homebrew/homebrew-core/Formula/mecab-ko.rb 21/app/.linuxbrew/Library/Taps/homebrew/homebrew-core/Formula/mecab-ipadic.rb 22/app/.linuxbrew/Library/Taps/homebrew/homebrew-core/Formula/mecab-ko-dic.rb 23/app/.linuxbrew/Library/Taps/homebrew/homebrew-core/Formula/mecab.rb 24/app/.linuxbrew/Library/Taps/homebrew/homebrew-core/Formula/mecab-jumandic.rb 25/app/.linuxbrew/Library/Taps/homebrew/homebrew-core/Formula/mecab-unidic.rb 26/app/.linuxbrew/Library/Taps/homebrew/homebrew-core/Formula/mecab-unidic-extended.rb 27/app/.linuxbrew/share/man/man1/mecab.1 28/app/.linuxbrew/var/homebrew/locks/mecab.formula.lock 29/app/.linuxbrew/var/homebrew/locks/a3da242228cf276ea0b7776960145ae549f7ff3985e0ea873d7c145f4fbf9650--mecab-ipadic-2.7.0-20070801.x86_64_linux.bottle.tar.gz.incomplete.lock 30/app/.linuxbrew/var/homebrew/linked/mecab-ipadic 31/app/.linuxbrew/var/homebrew/linked/mecab 32/app/.linuxbrew/etc/mecabrc 33/app/.linuxbrew/lib/libmecab.so 34/app/.linuxbrew/lib/libmecab.so.2.0.0 35/app/.linuxbrew/lib/mecab 36/app/.linuxbrew/lib/libmecab.a 37/app/.linuxbrew/lib/libmecab.so.2 38/app/.linuxbrew/include/mecab.h 39/app/.linuxbrew/bin/mecab 40/app/.linuxbrew/bin/mecab-config 41/app/.linuxbrew/opt/mecab-ipadic 42/app/.linuxbrew/opt/mecab 43/app/app/.linuxbrew/lib/libmecab.so.2

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

自己解決

pathが通ってなかっただけでした。
もう一度設定しなおしたら出来ました。

投稿2019/06/06 05:49

shuzi

総合スコア197

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問