2

https://github.com/diasks2/heroku-buildpack-mecab を用いてHerokuにmecabを入れようとしましたが、できませんでした。

mecabを入れたい理由は、nattoを使うためです。もし、herokuでnattoを使っている方で、herokuのイントール方法が分かる方がいらっしゃれば教えていただきたいです。

エラーログ

Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 1.09 KiB | 371.00 KiB/s, done.
Total 5 (delta 0), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Ruby app detected
remote: -----> Compiling Ruby
remote: -----> Using Ruby version: ruby-2.3.4
remote: -----> Installing dependencies using bundler 1.15.2
remote:        Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote:        Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.0.pre.2). We suggest you upgrade to the latest version of Bundler by running `gem install bundler --pre`.
remote:        Fetching gem metadata from https://rubygems.org/.
remote:        Fetching version metadata from https://rubygems.org/
remote:        Using bundler 1.15.2
remote:        Fetching mecab 0.996
remote:        Installing mecab 0.996 with native extensions
remote:        Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
remote:        current directory:
remote:        /tmp/build_329729ef0eca3400055681880f97452b/vendor/bundle/ruby/2.3.0/gems/mecab-0.996/ext/mecab
remote:        /tmp/build_329729ef0eca3400055681880f97452b/vendor/ruby-2.3.4/bin/ruby -r
remote:        ./siteconf20171211-265-7zd2yx.rb extconf.rb
remote:        checking for make... yes
remote:        *** extconf.rb failed ***
remote:        Could not create Makefile due to some reason, probably lack of necessary
remote:        libraries and/or headers.  Check the mkmf.log file for more details.  You may
remote:        need configuration options.
remote:        Provided configuration options:
remote:        --with-opt-dir
remote:        --without-opt-dir
remote:        --with-opt-include
remote:        --without-opt-include=${opt-dir}/include
remote:        --with-opt-lib
remote:        --without-opt-lib=${opt-dir}/lib
remote:        --with-make-prog
remote:        --without-make-prog
remote:        --srcdir=.
remote:        --curdir
remote:        --ruby=/tmp/build_329729ef0eca3400055681880f97452b/vendor/ruby-2.3.4/bin/$(RUBY_BASE_NAME)
remote:        --with-mecab-config
remote:        --without-mecab-config
remote:        --enable-mecab-config
remote:        --disable-mecab-config
remote:        extconf.rb:12:in ``': No such file or directory - mecab-config (Errno::ENOENT)
remote:        from extconf.rb:12:in `<main>'
remote:        To see why this extension failed to compile, please check the mkmf.log which can
remote:        be found here:
remote:        /tmp/build_329729ef0eca3400055681880f97452b/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/mecab-0.996/mkmf.log
remote:        extconf failed, exit code 1
remote:        Gem files will remain installed in
remote:        /tmp/build_329729ef0eca3400055681880f97452b/vendor/bundle/ruby/2.3.0/gems/mecab-0.996
remote:        for inspection.
remote:        Results logged to
remote:        /tmp/build_329729ef0eca3400055681880f97452b/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/mecab-0.996/gem_make.out
remote:        An error occurred while installing mecab (0.996), and Bundler cannot continue.
remote:        Make sure that `gem install mecab -v '0.996'` succeeds before bundling.
remote:        In Gemfile:
remote:        mecab
remote:        Bundler Output: Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.0.pre.2). We suggest you upgrade to the latest version of Bundler by running `gem install bundler --pre`.
remote:        Fetching gem metadata from https://rubygems.org/.
remote:        Fetching version metadata from https://rubygems.org/
remote:        Using bundler 1.15.2
remote:        Fetching mecab 0.996
remote:        Installing mecab 0.996 with native extensions
remote:        Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
remote:
remote:        current directory:
remote:        /tmp/build_329729ef0eca3400055681880f97452b/vendor/bundle/ruby/2.3.0/gems/mecab-0.996/ext/mecab
remote:        /tmp/build_329729ef0eca3400055681880f97452b/vendor/ruby-2.3.4/bin/ruby -r
remote:        ./siteconf20171211-265-7zd2yx.rb extconf.rb
remote:        checking for make... yes
remote:        *** extconf.rb failed ***
remote:        Could not create Makefile due to some reason, probably lack of necessary
remote:        libraries and/or headers.  Check the mkmf.log file for more details.  You may
remote:        need configuration options.
remote:
remote:        Provided configuration options:
remote:        --with-opt-dir
remote:        --without-opt-dir
remote:        --with-opt-include
remote:        --without-opt-include=${opt-dir}/include
remote:        --with-opt-lib
remote:        --without-opt-lib=${opt-dir}/lib
remote:        --with-make-prog
remote:        --without-make-prog
remote:        --srcdir=.
remote:        --curdir
remote:        --ruby=/tmp/build_329729ef0eca3400055681880f97452b/vendor/ruby-2.3.4/bin/$(RUBY_BASE_NAME)
remote:        --with-mecab-config
remote:        --without-mecab-config
remote:        --enable-mecab-config
remote:        --disable-mecab-config
remote:        extconf.rb:12:in ``': No such file or directory - mecab-config (Errno::ENOENT)
remote:        from extconf.rb:12:in `<main>'
remote:
remote:        To see why this extension failed to compile, please check the mkmf.log which can
remote:        be found here:
remote:
remote:        /tmp/build_329729ef0eca3400055681880f97452b/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/mecab-0.996/mkmf.log
remote:
remote:        extconf failed, exit code 1
remote:
remote:        Gem files will remain installed in
remote:        /tmp/build_329729ef0eca3400055681880f97452b/vendor/bundle/ruby/2.3.0/gems/mecab-0.996
remote:        for inspection.
remote:        Results logged to
remote:        /tmp/build_329729ef0eca3400055681880f97452b/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/mecab-0.996/gem_make.out
remote:
remote:        An error occurred while installing mecab (0.996), and Bundler cannot continue.
remote:        Make sure that `gem install mecab -v '0.996'` succeeds before bundling.
remote:
remote:        In Gemfile:
remote:        mecab
remote:  !
remote:  !     Failed to install gems via Bundler.
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !   Push rejected to afternoon-scrubland-60893.
remote:
To https://git.heroku.com/afternoon-scrubland-60893.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/afternoon-scrubland-60893.git
1

1 件の回答 1

1

こんにちは。類似の質問をして、回答をいただきました。

もしまだこちらの問題でお悩みであれば、こちらをご覧になってみてください。

MeCabを用いたSinatraアプリをHerokuにデプロイする方法をご教示ください。

上記の質問でいただいたご指摘の通り1つずつ修正を進めたところ、

No such file or directory - mecab-config (Errno::ENOENT)
remote:        from extconf.rb:12:in `<main>'

というエラーはLD_LIBRARY_PATHのミスが原因と見えました。

ただ、環境変数の設定変更のみではうまくいかない場合もありそうです。

私はrubyのバージョンをGemfile内で指定することで、ひとまずデプロイはできました。

しかしデプロイ後さらにApplication Errorでつまづきました。

デプロイが完了してApplication Errorになる状態まで到達するとわかりますが、gem nattoをrequireする行にてエラーが出ます。nattoは使えないのかもしれない…?です。

nattoを使わなくてもmecabというgemさえあれば問題ないと思いますので、以上、よろしければお試しください。

この質問に回答するには、ログインする必要があります。

求めていた回答ではありませんか? のタグが付いた他の質問を参照する。