gabrielcsapo/docusaurus-plugin-search-local

Unable to run the plugin locally

Closed this issue · 1 comments

I followed the steps in the CONTRIBUTING.md file to run and test the plugin locally.

npm run start in the root folder works as expected, however, when we run the command (in a separate terminal) for the website folder, the following error shows up:

[ERROR] Error: Cannot find module 'docusaurus-plugin-search-local'
Require stack:
- /Users/me/repos/docusaurus-plugin-search-local/website/docusaurus.config.js
- /Users/me/repos/docusaurus-plugin-search-local/node_modules/@docusaurus/core/lib/server/config.js
- /Users/me/repos/docusaurus-plugin-search-local/node_modules/@docusaurus/core/lib/server/index.js
- /Users/me/repos/docusaurus-plugin-search-local/node_modules/@docusaurus/core/lib/commands/build.js
- /Users/me/repos/docusaurus-plugin-search-local/node_modules/@docusaurus/core/lib/index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.resolve (node:internal/modules/cjs/helpers:108:19)
    at Object.<anonymous> (/Users/me/repos/docusaurus-plugin-search-local/website/docusaurus.config.js:35:15)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at module.exports (/Users/me/repos/docusaurus-plugin-search-local/node_modules/import-fresh/index.js:32:59)
    at loadSiteConfig (/Users/me/repos/docusaurus-plugin-search-local/node_modules/@docusaurus/core/lib/server/config.js:36:55

I believe this can be fixed by importing the plugin from the root-level folder, but I am not sure how that would work. Referencing the root src folder or the server/index.ts did not work.

I was trying to install the plugin "locally" as per these docs: https://docusaurus.io/docs/using-plugins#installing-a-plugin

should be fixed with #53 as we now use the relative path instead of the full path.