hexenq / kuroshiro

Japanese language library for converting Japanese sentence to Hiragana, Katakana or Romaji with furigana and okurigana modes supported.
https://kuroshiro.org
MIT License
781 stars 88 forks source link

TypeError: Kuroshiro is not a constructor #66

Closed Tenpi closed 4 years ago

Tenpi commented 4 years ago

I get this error using both import and require statements. I have tried reinstalling the package but it does not work.

Import: import Kuroshiro from "kuroshiro"; const kuroshiro = new Kuroshiro();

Require: const {Kuroshiro} = require("kuroshiro"); const kuroshiro = new Kuroshiro();

Tenpi commented 4 years ago

I fixed this issue, nvm.

danghuudat commented 3 years ago

how can you fix it?

univeous commented 2 years ago

@danghuudat I have the same issue, and it works fine when I changed to use kuroshiro 1.1.2 version.

hw4n commented 2 years ago

I can confirm @univeous' solution works.

in package.json, mine looked like the following: "kuroshiro": "^1.1.2",

however yarn install installed kuroshiro version 1.1.0, and the error was there

so changing that line to the following fixed the problem (replace caret with tilde) "kuroshiro": "~1.1.2",