{"record":{"id":"522a3d35a478223a","repo":"withastro/astro","slug":"cacheprovidernotfound","errorCode":"CacheProviderNotFound","errorMessage":"Could not resolve the cache provider `${provider}`. Make sure the package is installed.","messagePattern":"Could not resolve the cache provider `(.+?)`\\. Make sure the package is installed\\.","errorType":"exception","errorClass":"AstroError","httpStatus":null,"severity":"error","filePath":"packages/astro/src/core/cache/vite-plugin.ts","lineNumber":52,"sourceCode":"\t\tload: {\n\t\t\tfilter: {\n\t\t\t\tid: new RegExp(`^${RESOLVED_VIRTUAL_CACHE_PROVIDER_ID}$`),\n\t\t\t},\n\t\t\tasync handler() {\n\t\t\t\tconst provider = normalizeCacheProviderConfig(providerConfig);\n\t\t\t\t// Use the project root as the importer so that adapter-provided\n\t\t\t\t// providers (e.g. astro/cache/memory) resolve from the project's\n\t\t\t\t// node_modules, not from astro core's location.\n\t\t\t\tconst importerPath = fileURLToPath(new URL('package.json', settings.config.root));\n\t\t\t\tlet resolved;\n\t\t\t\ttry {\n\t\t\t\t\tresolved = await this.resolve(provider.entrypoint, importerPath);\n\t\t\t\t} catch {\n\t\t\t\t\t// Resolution can throw for invalid package specifiers\n\t\t\t\t}\n\t\t\t\tif (!resolved) {\n\t\t\t\t\tconst displayName = provider.name ?? provider.entrypoint;\n\t\t\t\t\tthrow new AstroError({\n\t\t\t\t\t\t...CacheProviderNotFound,\n\t\t\t\t\t\tmessage: CacheProviderNotFound.message(displayName),\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\tcode: `import { default as _default } from '${resolved.id}';\\nexport * from '${resolved.id}';\\nexport default _default;`,\n\t\t\t\t};\n\t\t\t},\n\t\t},\n\t};\n}\n","sourceCodeStart":34,"sourceCodeEnd":65,"githubUrl":"https://github.com/withastro/astro/blob/52e6c34790cc8ac4e69e6135ace06049867e5c4a/packages/astro/src/core/cache/vite-plugin.ts#L34-L65","documentation":"At dev/build startup the cache Vite plugin resolves your configured provider's `entrypoint`, using the project root's package.json as importer so adapter-provided providers (e.g. `astro/cache/memory`) resolve from your project's node_modules, not from astro core's location. If resolution fails or throws for an invalid specifier, `CacheProviderNotFound` is thrown with the provider's display name (`name` or entrypoint).","triggerScenarios":"Setting `cache: { provider: { entrypoint: 'my-cache-provider' } }` when that package is not installed, is misspelled, publishes no valid exports map, or is not resolvable from the project root's node_modules (pnpm strictness, monorepo hoisting problems).","commonSituations":"Forgetting to `npm install` the provider package after adding the config; typo in the entrypoint string; using an adapter-provided provider entrypoint without the adapter installed; workspace where the package is only a transitive dependency.","solutions":["Install the provider package: `npm install my-cache-provider`.","Verify it resolves from the project root: `node -e \"console.log(require.resolve('my-cache-provider'))\"` run at the root.","Fix spelling of the entrypoint or use the provider's `name` for a clearer error/identification.","For adapter-provided entrypoints, install and configure the matching adapter so the package lands in the project's node_modules."],"exampleFix":"// before — package not installed\nexport default defineConfig({\n  cache: { provider: { entrypoint: 'my-cache-provider' } },\n});\n\n# after\nnpm install my-cache-provider\n\nexport default defineConfig({\n  cache: { provider: { entrypoint: 'my-cache-provider' } },\n});","handlingStrategy":"validation","validationCode":"// Preflight: provider entrypoint must resolve from the project root,\n// mirroring the importer the cache vite-plugin uses\nimport { createRequire } from 'node:module';\nconst require = createRequire(new URL('./package.json', import.meta.url));\ntry {\n  require.resolve('my-cache-provider');\n} catch {\n  console.error('Configured cache provider is not installed. Run: npm install my-cache-provider');\n  process.exit(1);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the cache provider package in the project's own `dependencies`.","When using adapter-provided entrypoints (e.g. 'astro/cache/memory'), install the matching adapter.","Re-run the dev server after installing so Vite re-resolves the entrypoint."],"tags":["cache","dependency-resolution","configuration"],"backgroundTag":"module-not-found","analyzedSha":"52e6c34790cc8ac4e69e6135ace06049867e5c4a","analyzedAt":"2026-08-18T18:48:03.901Z","contentChangedAt":"2026-08-18T18:48:03.901Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}