{"record":{"id":"80dd29b4c94648f1","repo":"tailwindlabs/tailwindcss","slug":"could-not-resolve-id-from-base","errorCode":null,"errorMessage":"Could not resolve '${id}' from '${base}'","messagePattern":"Could not resolve '(.+?)' from '(.+?)'","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@tailwindcss-node/src/compile.ts","lineNumber":127,"sourceCode":"    async loadModule(id, base) {\n      return loadModule(id, base, () => {})\n    },\n    async loadStylesheet(id, base) {\n      return loadStylesheet(id, base, () => {})\n    },\n  })\n}\n\nexport async function loadModule(\n  id: string,\n  base: string,\n  onDependency: (path: string) => void,\n  customJsResolver?: Resolver,\n) {\n  if (id[0] !== '.') {\n    let resolvedPath = await resolveJsId(id, base, customJsResolver)\n    if (!resolvedPath) {\n      throw new Error(`Could not resolve '${id}' from '${base}'`)\n    }\n\n    let module = await importModule(pathToFileURL(resolvedPath).href)\n    return {\n      path: resolvedPath,\n      base: path.dirname(resolvedPath),\n      module: module.default ?? module,\n    }\n  }\n\n  let resolvedPath = await resolveJsId(id, base, customJsResolver)\n  if (!resolvedPath) {\n    throw new Error(`Could not resolve '${id}' from '${base}'`)\n  }\n\n  let [module, moduleDependencies] = await Promise.all([\n    importModule(pathToFileURL(resolvedPath).href + '?id=' + Date.now()),\n    getModuleDependencies(resolvedPath),","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/tailwindlabs/tailwindcss/blob/16e94cbf7f965c5ad697e90e940b5e178efad67c/packages/@tailwindcss-node/src/compile.ts#L109-L145","documentation":"`loadModule` resolves JavaScript module ids for `@plugin` / `@config` directives. When the id is a bare specifier (does not start with `.`), it is resolved via `resolveJsId` against `base`; if resolution returns nothing, the plugin/config package cannot be found. This mirrors Node's module-not-found semantics for plugin packages.","triggerScenarios":"`@plugin \"@tailwindcss/typography\"` when that package is not installed in `node_modules`, or a bare specifier with a typo. `id[0] !== '.'` is true, `resolveJsId` returns falsy, and compile.ts:127 throws.","commonSituations":"Missing `npm install` of a plugin package, monorepo where the plugin is hoisted to a workspace root not visible from `base`, or using a plugin that is only a devDependency in a different workspace.","solutions":["Install the missing package: `npm install <plugin-name>` (or the appropriate workspace install).","Check the spelling and scoped name in the `@plugin`/`@config` directive against the package's published name.","Verify the package is resolvable from the CSS file's base directory (run `node -e \"require.resolve('<id>')\"` from that folder)."],"exampleFix":"/* before */\n@plugin \"@tailwindcss/typograph\";\n\n# after\nnpm install @tailwindcss/typography\n/* @plugin \"@tailwindcss/typography\"; */","handlingStrategy":"validation","validationCode":"import { createRequire } from 'node:module'\nfunction assertPluginResolvable(id: string, base: string) {\n  if (id[0] === '.') return // handled by relative check\n  try { createRequire(path.resolve(base, 'noop.js')).resolve(id) }\n  catch { throw new Error(`Plugin '${id}' not installed; run: npm install ${id}`) }\n}","typeGuard":"function isBareSpecifier(id: string): boolean { return id[0] !== '.' }","tryCatchPattern":"try {\n  await loadModule(id, base, () => {})\n} catch (e) {\n  if (/Could not resolve/.test((e as Error).message) && id[0] !== '.') {\n    console.error(`Install missing dependency: npm install ${id}`)\n  }\n  throw e\n}","preventionTips":["Install all @plugin packages as real dependencies before building.","Verify resolvability with require.resolve from the CSS file's directory.","Check scoped package name spelling in @plugin directives."],"tags":["plugin-resolution","module-not-found","config"],"backgroundTag":null,"analyzedSha":"16e94cbf7f965c5ad697e90e940b5e178efad67c","analyzedAt":"2026-08-12T06:02:42.469Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}