Node is not able to run a Command Line: mecab

87 Views Asked by At

I am trying to run this code from this repo node-mecab

for analyzing japanese text

import { analyze } from "@enjoyjs/node-mecab";

const result = await analyze("こんにちは世界");
console.log(result);`

error = new Error(message);
                
Error: Command failed with exit code 1: mecab
'mecab' not recognized as an internal command or external, an operable program or a batch file.

    at makeError (c:\Users\zhark\OneDrive\desktop\Anime Subtitles\mecabNode\node_modules\execa\lib\error.js:60:11)
    at handlePromise (c:\Users\zhark\OneDrive\desktop\Anime Subtitles\mecabNode\node_modules\execa\index.js:118:26)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async u (file:///c:/Users/zhark/OneDrive/desktop/Anime%20Subtitles/mecabNode/node_modules/@enjoyjs/node-mecab/lib/index.mjs:1:810)
    at async file:///c:/Users/zhark/OneDrive/desktop/Anime%20Subtitles/mecabNode/index.js:3:16 {
  shortMessage: 'Command failed with exit code 1: mecab',
  command: 'mecab',
  escapedCommand: 'mecab',
  exitCode: 1,
  signal: undefined,
  signalDescription: undefined,
  stdout: '',
  stderr: "not recognized as an internal command or external, an operable program or a batch file.',
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}

Node.js v18.14.2

I tried using Python library for MeCab and it succeeds to run CLI commands, it seems to be a problem with Node.js settings.

I use Windows System and WindosTerminal/gitbash, I can manually run mecab CLI, but not with Node.js so I have no idea where to start solving this problem

I a beginner and not well familiarized with Python that's why I need to work with node/js in order to successfully manipulate japanese texts.

0

There are 0 best solutions below