Kiedy próbowałem uruchomić serwer kolejowy, mam błąd związany z MeCabem, więc podążałem pod poniższą instrukcją, aby zainstalować MeCab i został zainstalowany pomyślnie sprawdziłem wersję MeCab

Instalowanie Mecab następowały

1. gem install natto
2. sudo apt-get install mecab libmecab-dev
3. sudo apt-get install mecab-ipadic-utf8
4. mecab --version
5. sudo find / -name libmecab.so*

    this gives an error of permission denied

6. echo 'export MECAB_PATH=/usr/lib/libmecab.so.2' >> ~/.bash_profile
7. source ~/.bash_profile

W końcu to, kiedy próbowałem rozpocząć serwer Rails, podałem poniżej błąd

/home/admin123/.rvm/gems/ruby-2.3.1/gems/ffi-1.9.14/lib/ffi/library.rb:147:in `block in ffi_lib': Could not open library '/usr/lib/libmecab.so.2': /usr/lib/libmecab.so.2: cannot open shared object file: No such file or directory (LoadError)
    from /home/admin123/.rvm/gems/ruby-2.3.1/gems/ffi-1.9.14/lib/ffi/library.rb:100:in `map'
    from /home/admin123/.rvm/gems/ruby-2.3.1/gems/ffi-1.9.14/lib/ffi/library.rb:100:in `ffi_lib'
    from /home/admin123/.rvm/gems/ruby-2.3.1/gems/natto-1.1.1/lib/natto/binding.rb:64:in `<module:Binding>'
    from /home/admin123/.rvm/gems/ruby-2.3.1/gems/natto-1.1.1/lib/natto/binding.rb:6:in `<module:Natto>'
    from /home/admin123/.rvm/gems/ruby-2.3.1/gems/natto-1.1.1/lib/natto/binding.rb:2:in `<top (required)>'
    from /home/admin123/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require'
    from /home/admin123/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `block in require'
    from /home/admin123/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:240:in `load_dependency'
    from /home/admin123/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require'
    from /home/admin123/.rvm/gems/ruby-2.3.1/gems/natto-1.1.1/lib/natto/natto.rb:2:in `<top (required)>'
    from /home/admin123/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require'
    from /home/admin123/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `block in require'
    from /home/admin123/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:240:in `load_dependency'
    from /home/admin123/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require'
    from /home/admin123/.rvm/gems/ruby-2.3.1/gems/natto-1.1.1/lib/natto.rb:2:in `<top (required)>'
    from /usr/share/rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/bundler/runtime.rb:81:in `require'
    from /usr/share/rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/bundler/runtime.rb:81:in `block (2 levels) in require'
    from /usr/share/rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/bundler/runtime.rb:76:in `each'
    from /usr/share/rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/bundler/runtime.rb:76:in `block in require'
    from /usr/share/rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/bundler/runtime.rb:65:in `each'
    from /usr/share/rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/bundler/runtime.rb:65:in `require'
    from /usr/share/rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/bundler.rb:114:in `require'
    from /home/admin123/WFSGo/myproject/config/application.rb:16:in `<top (required)>'
    from /home/admin123/.rvm/gems/ruby-2.3.1/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:78:in `require'
    from /home/admin123/.rvm/gems/ruby-2.3.1/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:78:in `block in server'
    from /home/admin123/.rvm/gems/ruby-2.3.1/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `tap'
    from /home/admin123/.rvm/gems/ruby-2.3.1/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `server'
    from /home/admin123/.rvm/gems/ruby-2.3.1/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /home/admin123/.rvm/gems/ruby-2.3.1/gems/railties-4.2.4/lib/rails/commands.rb:17:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'
1
Savan 11 grudzień 2019, 05:50

1 odpowiedź

Najlepsza odpowiedź

Na ubuntu mecab lib jest w /usr/lib/x86_64-linux-gnu/libmecab.so. Więc to powinno działać:

export MECAB_PATH=/usr/lib/x86_64-linux-gnu/libmecab.so
rails server
2
Casper 11 grudzień 2019, 04:20