{"record":{"id":"eb29551813efb55a","repo":"facebook/docusaurus","slug":"docusaurus-was-unable-to-resolve-the-modulename","errorCode":null,"errorMessage":"Docusaurus was unable to resolve the \"${moduleName}\" ${moduleType}. Make sure one of the following packages are installed:\\n${modulePatterns.map((m) => `- ${m}`).join('\\n')}","messagePattern":"Docusaurus was unable to resolve the \"(.+?)\" (.+?)\\. Make sure one of the following packages are installed:\\\\n(.+?)`\\)\\.join\\('\\\\n'\\)\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/docusaurus/src/server/plugins/moduleShorthand.ts","lineNumber":48,"sourceCode":"  ];\n}\n\nexport function resolveModuleName(\n  moduleName: string,\n  moduleRequire: NodeRequire,\n  moduleType: 'preset' | 'theme' | 'plugin',\n): string {\n  const modulePatterns = getNamePatterns(moduleName, moduleType);\n  const module = modulePatterns.find((m) => {\n    try {\n      moduleRequire.resolve(m);\n      return true;\n    } catch {\n      return false;\n    }\n  });\n  if (!module) {\n    throw new Error(`Docusaurus was unable to resolve the \"${moduleName}\" ${moduleType}. Make sure one of the following packages are installed:\n${modulePatterns.map((m) => `- ${m}`).join('\\n')}`);\n  }\n  return module;\n}\n","sourceCodeStart":30,"sourceCodeEnd":53,"githubUrl":"https://github.com/facebook/docusaurus/blob/3f483e80e326cc646b54b83d564b3f0c4881b9a6/packages/docusaurus/src/server/plugins/moduleShorthand.ts#L30-L53","documentation":"Thrown by `resolveModuleName` when none of the generated name patterns for a preset/theme/plugin resolve via `require.resolve`. Docusaurus expands a shorthand name (e.g. `'classic'`) into candidate package names and tries each; if all fail, it reports the full candidate list so the user knows exactly which package to install.","triggerScenarios":"Referencing `presets: ['classic']`, `themes: ['live-codeblock']`, or `plugins: ['my-plugin']` when the corresponding npm package is not installed. The loop at moduleShorthand.ts:38-46 tries each pattern and the throw at :47-50 fires when `module` stays undefined.","commonSituations":"Forgetting to `npm install @docusaurus/preset-classic`; typo in the preset/plugin name; using a private/local plugin without the correct package name or path; monorepo package not built/linked.","solutions":["Install the missing package: `npm install @docusaurus/preset-classic` (use the exact name from the error's candidate list).","Fix typos in the preset/plugin string.","For local plugins, pass the resolved path (`require.resolve('./my-plugin')`) instead of a package name.","In a monorepo, ensure the package is built (`pnpm --filter <pkg> build`) and resolvable from the site dir."],"exampleFix":"// before\npresets: ['classic'],  // but @docusaurus/preset-classic not installed\n// after (install first)\n//   npm i @docusaurus/preset-classic\npresets: ['classic'],","handlingStrategy":"validation","validationCode":"function isResolvable(name: string): boolean {\n  try { require.resolve(name); return true; } catch { return false; }\n}\nif (!isResolvable('@docusaurus/preset-classic')) {\n  throw new Error('Run: npm i @docusaurus/preset-classic');\n}","typeGuard":null,"tryCatchPattern":"try {\n  const preset = resolveModuleName('classic', 'preset');\n} catch (e) {\n  console.error('Preset not installed:', (e as Error).message);\n  throw e;\n}","preventionTips":["Install all referenced presets/plugins/themes before `docusaurus start`.","For local plugins, pass `require.resolve('./path')` rather than bare names.","Run `pnpm install` after editing presets/plugins in config."],"tags":["plugins","presets","themes","resolution","install"],"backgroundTag":null,"analyzedSha":"3f483e80e326cc646b54b83d564b3f0c4881b9a6","analyzedAt":"2026-08-12T13:25:04.382Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}