{"record":{"id":"710f6c57ea95624c","repo":"parcel-bundler/parcel","slug":"could-not-find-a-parcelrc","errorCode":null,"errorMessage":"Could not find a .parcelrc","messagePattern":"Could not find a \\.parcelrc","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/core/src/requests/ParcelConfigRequest.js","lineNumber":138,"sourceCode":"  let {config: processedConfig, cachePath} = result;\n  let config = parcelConfigCache.get(cachePath);\n  if (config) {\n    return config;\n  }\n\n  config = new ParcelConfig(processedConfig, options);\n\n  parcelConfigCache.set(cachePath, config);\n  return config;\n}\n\nexport async function loadParcelConfig(\n  options: ParcelOptions,\n): Promise<{|...ParcelConfigChain, usedDefault: boolean|}> {\n  let parcelConfig = await resolveParcelConfig(options);\n\n  if (!parcelConfig) {\n    throw new Error('Could not find a .parcelrc');\n  }\n\n  return parcelConfig;\n}\n\nexport async function resolveParcelConfig(\n  options: ParcelOptions,\n): Promise<?{|...ParcelConfigChain, usedDefault: boolean|}> {\n  let resolveFrom = getResolveFrom(options.inputFS, options.projectRoot);\n  let configPath =\n    options.config != null\n      ? (await options.packageManager.resolve(options.config, resolveFrom))\n          .resolved\n      : await resolveConfig(\n          options.inputFS,\n          resolveFrom,\n          ['.parcelrc'],\n          options.projectRoot,","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/parcel-bundler/parcel/blob/59484858a1a0bcbb71f74088956bb437a2db6505/packages/core/core/src/requests/ParcelConfigRequest.js#L120-L156","documentation":"Thrown by loadParcelConfig() when resolveParcelConfig() returns null — meaning no .parcelrc was found in the project root (or anywhere up the tree), and no defaultConfig was available to fall back on. Parcel requires a config to know which transformers, resolvers, and namers to use.","triggerScenarios":"resolveParcelConfig() returns null when configPath is null after both the explicit config lookup (resolveConfig for .parcelrc) and the defaultConfig fallback fail. This happens when there is no .parcelrc file and options.defaultConfig is null or its resolve also fails.","commonSituations":"Running Parcel in a project that never had a .parcelrc and where @parcel/config-default is not installed or resolvable; monorepo where the config is at the workspace root but Parcel is run from a subdirectory without proper resolution; corrupted node_modules missing the default config package; programmatic API usage where defaultConfig was not passed.","solutions":["Install the default config: npm install --save-dev @parcel/config-default.","Create a .parcelrc in the project root: { \"extends\": \"@parcel/config-default\" }.","If using the programmatic API, pass defaultConfig: '@parcel/config-default' in options.","In a monorepo, ensure the config package is resolvable from the directory where Parcel runs (hoist it or install locally).","Run npm install / yarn install to ensure node_modules is complete."],"exampleFix":"// before — programmatic API without default config\nconst bundler = new Parcel({ entries: 'src/index.html' });\n\n// after\nconst bundler = new Parcel({\n  entries: 'src/index.html',\n  defaultConfig: '@parcel/config-default',\n});","handlingStrategy":"validation","validationCode":"const fs = require('fs');\nconst path = require('path');\nfunction validateParcelConfigExists(projectRoot) {\n  const parcelrc = path.join(projectRoot, '.parcelrc');\n  const hasFile = fs.existsSync(parcelrc);\n  // Check if @parcel/config-default is resolvable\n  let hasDefault = false;\n  try {\n    require.resolve('@parcel/config-default', { paths: [projectRoot] });\n    hasDefault = true;\n  } catch {}\n  if (!hasFile && !hasDefault) {\n    throw new Error('No .parcelrc found and @parcel/config-default is not installed.');\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always install @parcel/config-default as a devDependency when adding Parcel to a project.","Create a .parcelrc that extends the default config for explicitness.","In programmatic usage, always pass defaultConfig: '@parcel/config-default'."],"tags":["parcelrc","config","missing-config","setup"],"backgroundTag":null,"analyzedSha":"59484858a1a0bcbb71f74088956bb437a2db6505","analyzedAt":"2026-08-13T04:06:35.925Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}