Open andrew-polk opened 2 months ago
Note that while I am using docusaurus v2, this error occurs with v3 as well. I used https://docusaurus.new/, just added the dependency, and added
themes: [
[
require.resolve("@easyops-cn/docusaurus-search-local"),
{
language: ["en", "hi"]
},
],
],
to the config.
That gave:
[ERROR] Error: Unable to build website for locale en.
at tryToBuildLocale (/project/workspace/node_modules/@docusaurus/core/lib/commands/build.js:54:19)
at async /project/workspace/node_modules/@docusaurus/core/lib/commands/build.js:65:9
at async mapAsyncSequential (/project/workspace/node_modules/@docusaurus/utils/lib/jsUtils.js:20:24)
at async Command.build (/project/workspace/node_modules/@docusaurus/core/lib/commands/build.js:63:5) {
[cause]: TypeError: Cannot read properties of undefined (reading 'init')
at server.bundle.js:16693:15
at 1088 (server.bundle.js:14194:70)
at __webpack_require__ (server.bundle.js:28127:42)
at 7401 (server.bundle.js:11585:24)
at __webpack_require__ (server.bundle.js:28127:42)
at 7489 (server.bundle.js:8814:14)
at __webpack_require__ (server.bundle.js:28127:42)
at 6533 (server.bundle.js:9695:21)
at __webpack_require__ (server.bundle.js:28127:42)
at server.bundle.js:28193:37
}
Seems to be a lunr / lunr-languages issue, please share the result of yarn why lunr
and yarn why lunr-languages
In my v2 project:
$ yarn why lunr
...
=> Found "lunr@2.3.9"
info Reasons this module exists
- "@easyops-cn#docusaurus-search-local" depends on it
- Hoisted from "@easyops-cn#docusaurus-search-local#lunr"
$ yarn why lunr-languages
...
=> Found "lunr-languages@1.9.0"
info Reasons this module exists
- "@easyops-cn#docusaurus-search-local" depends on it
- Hoisted from "@easyops-cn#docusaurus-search-local#lunr-languages"
In the CodeSandbox using v3:
yarn why lunr
...
=> Found "lunr@2.3.9"
info Reasons this module exists
- "@easyops-cn#docusaurus-search-local" depends on it
- Hoisted from "@easyops-cn#docusaurus-search-local#lunr"
yarn why lunr-languages
...
=> Found "lunr-languages@1.14.0"
info Reasons this module exists
- "@easyops-cn#docusaurus-search-local" depends on it
- Hoisted from "@easyops-cn#docusaurus-search-local#lunr-languages"
After adding "hi" or "th" to the
language
prop (e.g.language: ["en", "hi"]
),docusaurus build
givesSeems to be caused by https://github.com/MihaiValentin/lunr-languages/issues/101.