Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module not found: Error: Can't resolve 'docusaurus-lunr-search/src/lunr.client' | docusaurus-v2 #5337

Closed
ImAbhishekTomar opened this issue Aug 11, 2021 · 1 comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution external This issue is caused by an external dependency and not Docusaurus.

Comments

@ImAbhishekTomar
Copy link

Anyone help on this issue, this is coming after lunr-search installation.

Error


Module not found: Error: Can't resolve 'docusaurus-lunr-search/src/lunr.client' in 'C:\Root\Projects\UMR_API_DOCS\Source\umr-api-docs\src\theme\SearchBar\lib'
Assigning to rvalue (2:0)
| Object(function webpackMissingModule() { var e = new Error("Cannot find module 'docusaurus-lunr-search/src/lunr.client'"); e.code = 'MODULE_NOT_FOUND'; throw e; }());
| Object(function webpackMissingModule() { var e = new Error("Cannot find module 'docusaurus-lunr-search/src/lunr.client'"); e.code = 'MODULE_NOT_FOUND'; throw e; }())=/[\s\-/]+/;var LunrSearchAdapter=/*#__PURE__*/function(){function Lun
rSearchAdapter(searchDocs,searchIndex){this.searchDocs=searchDocs;this.lunrIndex=Object(function webpackMissingModule() { var e = new Error("Cannot find module 'docusaurus-lunr-search/src/lunr.client'"); e.code = 'MODULE_NOT_FOUND'; thro
w e; }())(searchIndex);}var _proto=LunrSearchAdapter.prototype;_proto.getLunrResult=function getLunrResult(input){return this.lunrIndex.query(function(query){var tokens=Object(function webpackMissingModule() { var e = new Error("Cannot f
ind module 'docusaurus-lunr-search/src/lunr.client'"); e.code = 'MODULE_NOT_FOUND'; throw e; }())(input);query.term(tokens,{boost:10});query.term(tokens,{wildcard:Object(function webpackMissingModule() { var e = new Error("Cannot find mo
dule 'docusaurus-lunr-search/src/lunr.client'"); e.code = 'MODULE_NOT_FOUND'; throw e; }())});});};_proto.getHit=function getHit(doc,formattedTitle,formattedContent){return{hierarchy:{lvl0:doc.pageTitle||doc.title,lvl1:doc.type===0?null:
doc.title},url:doc.url,_snippetResult:formattedContent?{content:{value:formattedContent,matchLevel:"full"}}:null,_highlightResult:{hierarchy:{lvl0:{value:doc.type===0?formattedTitle||doc.title:doc.pageTitle},lvl1:doc.type===0?null:{value
:formattedTitle||doc.title}}}};};_proto.getTitleHit=function getTitleHit(doc,position,length){var start=position[0];var end=position[0]+length;var formattedTitle=doc.title.substring(0,start)+'<span class="algolia-docsearch-suggestion--hi
ghlight">'+doc.title.substring(start,end)+'</span>'+doc.title.substring(end,doc.title.length);return this.getHit(doc,formattedTitle);};_proto.getKeywordHit=function getKeywordHit(doc,position,length){var start=position[0];var end=positio
n[0]+length;var formattedTitle=doc.title+'<br /><i>Keywords: '+doc.keywords.substring(0,start)+'<span class="algolia-docsearch-suggestion--highlight">'+doc.keywords.substring(start,end)+'</span>'+doc.keywords.substring(end,doc.keywords.l
ength)+'</i>';return this.getHit(doc,formattedTitle);};_proto.getContentHit=function getContentHit(doc,position){var start=position[0];var end=position[0]+position[1];var previewStart=start;var previewEnd=end;var ellipsesBefore=true;var
ellipsesAfter=true;for(var k=0;k<3;k++){var nextSpace=doc.content.lastIndexOf(' ',previewStart-2);var nextDot=doc.content.lastIndexOf('.',previewStart-2);if(nextDot>0&&nextDot>nextSpace){previewStart=nextDot+1;ellipsesBefore=false;break;
}if(nextSpace<0){previewStart=0;ellipsesBefore=false;break;}previewStart=nextSpace+1;}for(var _k=0;_k<10;_k++){var _nextSpace=doc.content.indexOf(' ',previewEnd+1);var _nextDot=doc.content.indexOf('.',previewEnd+1);if(_nextDot>0&&_nextDo
t<_nextSpace){previewEnd=_nextDot;ellipsesAfter=false;break;}if(_nextSpace<0){previewEnd=doc.content.length;ellipsesAfter=false;break;}previewEnd=_nextSpace;}var preview=doc.content.substring(previewStart,start);if(ellipsesBefore){previe
w='... '+preview;}preview+='<span class="algolia-docsearch-suggestion--highlight">'+doc.content.substring(start,end)+'</span>';preview+=doc.content.substring(end,previewEnd);if(ellipsesAfter){preview+=' ...';}return this.getHit(doc,null,
preview);};_proto.search=function search(input){var _this=this;return new Promise(function(resolve,rej){var results=_this.getLunrResult(input);var hits=[];results.length>5&&(results.length=5);_this.titleHitsRes=[];_this.contentHitsRes=[]
;results.forEach(function(result){var doc=_this.searchDocs[result.ref];var metadata=result.matchData.metadata;for(var i in metadata){if(metadata[i].title){if(!_this.titleHitsRes.includes(result.ref)){var position=metadata[i].title.positi
on[0];hits.push(_this.getTitleHit(doc,position,input.length));_this.titleHitsRes.push(result.ref);}}else if(metadata[i].content){var _position=metadata[i].content.position[0];hits.push(_this.getContentHit(doc,_position));}else if(metadat
a[i].keywords){var _position2=metadata[i].keywords.position[0];hits.push(_this.getKeywordHit(doc,_position2,input.length));_this.titleHitsRes.push(result.ref);}}});hits.length>5&&(hits.length=5);resolve(hits);});};return LunrSearchAdapte
r;}();/* harmony default export */ var __WEBPACK_DEFAULT_EXPORT__ = (LunrSearchAdapter);
while analysing module C:\Root\Projects\UMR_API_DOCS\Source\umr-api-docs\node_modules\babel-loader\lib\index.js??ruleSet[1].rules[5].use[0]!C:\Root\Projects\UMR_API_DOCS\Source\umr-api-docs\src\theme\SearchBar\lib\lunar-search.js for con
catenation
Client bundle compiled with errors therefore further build is impossible.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

docusaurus.config.js


const lightCodeTheme = require('prism-react-renderer/themes/github');
const darkCodeTheme = require('prism-react-renderer/themes/dracula');
const path = require('path');

/** @type {import('@docusaurus/types').DocusaurusConfig} */
module.exports = {
  title: 'UMR API DOCS',
  //tagline: 'Dinosaurs are cool 1',
  url: 'https://github.optum.com',
  baseUrl: '/umr-api-docs/',
  onBrokenLinks: 'throw',
  onBrokenMarkdownLinks: 'warn',
  favicon: 'img/favicon.ico',
  organizationName: 'atomar10', // Usually your GitHub org/user name.
  projectName: 'umr-api-docs', // Usually your repo name.
  plugins: [
    [path.resolve(__dirname, './node_modules/docusurus-lunr-search/'), {
      indexBaseUrl: true,
      languages: ['en'],
      excludeRoutes: [
        'docs/changelogs/**/*', // exclude changelogs from indexing
      ]
    }]
  ],
  themeConfig: {
    navbar: {
      // title: 'UMR API',
      logo: {
        alt: 'umr api logo',
        src: 'img/umr_logo.png',
      },
      items: [
        // {
        //   type: 'docsVersionDropdown',
        // },
        {

          type: 'doc',
          docId: 'intro',
          position: 'left',
          label: 'Docs',
        },
        // {to: '/blog', label: 'Blog', position: 'left'},
        {
          href: 'https://optum.github.com/atomar10/umr-api-docs',
          label: 'GitHub',
          position: 'right',
        },
      ],
    },
    footer: {
      style: 'dark',
      links: [
        {
          title: 'Docs',
          items: [
            {
              label: 'Tutorial',
              to: '/docs/intro',
            },
          ],
        },
        {
          title: 'Community',
          items: [
            {
              label: 'Stack Overflow',
              href: 'https://stackoverflow.com/questions/tagged/docusaurus',
            },
            {
              label: 'Discord',
              href: 'https://discordapp.com/invite/docusaurus',
            },
            {
              label: 'Twitter',
              href: 'https://twitter.com/docusaurus',
            },
          ],
        },
        {
          title: 'More',
          items: [
            {
              label: 'Blog',
              to: '/blog',
            },
            {
              label: 'GitHub',
              href: 'https://optum.github.com/',
            },
          ],
        },
      ],
      copyright: `Copyright © ${new Date().getFullYear()} UMR.`,
    },
    prism: {
      theme: lightCodeTheme,
      darkTheme: darkCodeTheme,
    },
  },
  presets: [
    [
      '@docusaurus/preset-classic',
      {
        docs: {
          sidebarPath: require.resolve('./sidebars.js'),
          // Please change this to your repo.
          editUrl:
            'https://github.com/facebook/docusaurus/edit/master/website/',
        },
        blog: {
          showReadingTime: true,
          // Please change this to your repo.
          editUrl:
            'https://github.com/facebook/docusaurus/edit/master/website/blog/',
        },
        theme: {
          customCss: require.resolve('./src/css/custom.css'),
        },
      },
    ],
  ],
};

@ImAbhishekTomar ImAbhishekTomar added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Aug 11, 2021
@slorber
Copy link
Collaborator

slorber commented Aug 11, 2021

Sorry but the Lunr plugin is not an official core plugin and we don't provide support for it in this repo.

Assigning to rvalue => we had some users report this error due to using symlinks, that's all I can tell you

@slorber slorber closed this as completed Aug 11, 2021
@Josh-Cena Josh-Cena added external This issue is caused by an external dependency and not Docusaurus. and removed status: needs triage This issue has not been triaged by maintainers labels Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution external This issue is caused by an external dependency and not Docusaurus.
Projects
None yet
Development

No branches or pull requests

3 participants