docusaurus-search-local
docusaurus-search-local copied to clipboard
TypeError: Cannot read properties of undefined (reading 'substr')
I am running docusaurus with the following dependencies
"@docusaurus/core": "2.0.0-beta.18",
"@docusaurus/preset-classic": "2.0.0-beta.18",
"@easyops-cn/docusaurus-search-local": "^0.27.0",
This is build using Docker, on a Windows 64 Home machine.
The exact setup works for the following community plugins https://github.com/praveenn77/docusaurus-lunr-search https://github.com/cmfcmf/docusaurus-search-local I was however interested in this plugin because the show all results page.
When building I get a TypeError. Unfortunatly I don't know how to pinpoint the root of the problem.
#26 10.25 ℹ Compiling Client
#26 10.30 ℹ Compiling Server
#26 1236.9 ✔ Client: Compiled successfully in 20.44m
#26 1857.6 ✔ Server: Compiled successfully in 30.79m
#26 1936.5 [ERROR] Unable to build website for locale en.
#26 1936.9 [ERROR] TypeError: Cannot read properties of undefined (reading 'substr')
#26 1937.5 error Command failed with exit code 1.
#26 1937.5 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Can you provide a reproduction link? The error message didn't help much.
Or you can run DEBUG=search-local:* yarn build
to enable debugging log for this plugin. (or DEBUG=search-local:* npm run build
if you're using npm).
If that also didn't help, please try to downgrade to v0.26.1:
"@easyops-cn/docusaurus-search-local": "^0.26.1"
Maybe it's a regression introduced in v0.27.0, but I'm not sure.
I'm thinking it can only be this line if it works with 0.26. Looking at the beta.18 type specs that code seems to have changed a lot so maybe this change is not supported on < beta.20
@peirstom Can you try the latest version of our plugin with latest docusaurus, to see if the problem still exists?
I had the same issue. When upgrading to the latest version of the plugin with latest docusaurus, the problem doesn't exist anymore.
So I guess we can close this now? Feel free to reopen it or send a new issue if you still have problems.