oramasearch/orama

Docusaurus V3 plugin not working on fresh install

Closed this issue · 11 comments

Describe the bug

First we tried integrating the OSS version of the plugin on the existing solution instead of lunr search plugin but we got an error. To verify that the issue is with the orama plugin we've tried on a fresh docusaurus project and it did not work. We are getting some react errors.
See the image below:
image

Error link

When we run the website in development mode using: npm run start We get a following error which describes more the minified issue:

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Check the render method of `OramaSearchWithDocs`.

Thanks for taking your time!

To Reproduce

  1. Initialize fresh docusaurus project. It will create a docusaurus 3.4.0 site
  2. Build the website, to verify that docusaurus works. It works.
  3. Clear the build and cache folders
  4. Install orama docusaurus V3 plugin
  5. Add the plugin to docusaurus.config.ts
  6. Run npm run build
  7. Run npm run serve

Expected behavior

Site is built and docusaurus website is rendered with search box.

Environment Info

OS: Windows 11
Node: v20.10.0
Orama Plugin Version: 2.0.19
Docusaurus: 3.4.0

Affected areas

Initialization, Search

Additional context

No response

@dusanbobicic hopefully a fix gets pushed soon, but I got it to work with npm run swizzle.

I was able to get orama working with docusaurus 3.4.0, by using npm swizzle and ejecting: and then i updated @orama/searchbox, and then setting @orama/searchbox in my package.json to an older version at 1.0.0-rc33

Screenshot 2024-06-06 at 2 57 43 PM

I also tried a fresh OSS install on MacOS and got this error,
Error: ENOENT: no such file or directory, open ... /.docusaurus/orama-search-index-current.json.gz

Also the docs are lacking on how to integrate frontend SDKs like orama/searchbar

@madlitz I got the same error
Error: ENOENT: no such file or directory, open ... /.docusaurus/orama-search-index-current.json.gz

To reproduce

Inside docusaurus exising project install:

yarn add @orama/plugin-docusaurus-v3

in docusaurus.config.js file:
{ // ... plugins: ["@orama/plugin-docusaurus-v3"], // ... }
After these steps, yarn build command doesn't work.
Anyone know what's wrong?
Thanks

Is there any news or new version that fixes this issue?

Can confirm this is now fixed as of 2.0.20. Edit: Whoops, not really!

The docs don't say it specifically but you need to run:

npm run build first
... then
npm run start or npm run serve

The only bug I could see is that search results are not returning fragments which I have raised an issue #751

Oh and the "ask AI" field should not be there for the OSS version I assume.

I still get the Error: ENOENT: no such file or directory, open ... /.docusaurus/orama-search-index-current.json.gz

Docusaurus: 3.4.0
Orama plugin: 2.0.22

I use yarn and it's not a fresh install. I tried to build first, but it still shows that error while bulding. What am I doing wrong and how can I fix that?

UPD Tried with a fresh install, still doesn't work.

@LevGolumov Yeah when I said I confirmed it was fixed I accidentally left in a modified version of the file. I have the working fix in the PR above.

Also I removed the 'Orama AI' section with this css in my project:

div[class^="ShowSummaryCTA"] {
  display: none !important;
}

But it would be nice for the plugin to do this automatically. Unfortunately it looks like @orama/searchbox frontend code isn't included in this repo. I can only find the npm package that has already been minified.

Hit this while searching for an offline search plugin for Docusaurus... :(

I'm also getting this Error: ENOENT: no such file or directory, open ... /.docusaurus/orama-search-index-current.json.gz
when I'm trying to use the plugin.