{"record":{"id":"db090b0a195badf2","repo":"parcel-bundler/parcel","slug":"could-not-resolve-package-name-that-satisfies","errorCode":null,"errorMessage":"Could not resolve package \"${name}\" that satisfies ${range}. Found ${version}.","messagePattern":"Could not resolve package \"(.+?)\" that satisfies (.+?)\\. Found (.+?)\\.","errorType":"exception","errorClass":"ThrowableDiagnostic","httpStatus":null,"severity":"error","filePath":"packages/core/package-manager/src/NodePackageManager.js","lineNumber":409,"sourceCode":"                      conflicts.fields.map(field => ({\n                        key: `/${field}/${encodeJSONKeyComponent(name)}`,\n                        type: 'key',\n                        message: 'Found this conflicting local requirement.',\n                      })),\n                    ),\n                  },\n                ],\n              },\n            });\n          }\n\n          let version = pkg?.version;\n          let message = md`Could not resolve package \"${name}\" that satisfies ${range}.`;\n          if (version != null) {\n            message += md` Found ${version}.`;\n          }\n\n          throw new ThrowableDiagnostic({\n            diagnostic: {\n              message,\n              hints: [\n                'Looks like the incompatible version was installed transitively. Add this package as a direct dependency with a compatible version range.',\n              ],\n            },\n          });\n        }\n      }\n\n      cache.set(key, resolved);\n      invalidationsCache.clear();\n\n      // Add the specifier as a child to the parent module.\n      // Don't do this if the specifier was an absolute path, as this was likely a dynamically resolved path\n      // (e.g. babel uses require() to load .babelrc.js configs and we don't want them to be added  as children of babel itself).\n      if (!path.isAbsolute(name)) {\n        let moduleChildren = children.get(from);","sourceCodeStart":391,"sourceCodeEnd":427,"githubUrl":"https://github.com/parcel-bundler/parcel/blob/59484858a1a0bcbb71f74088956bb437a2db6505/packages/core/package-manager/src/NodePackageManager.js#L391-L427","documentation":"Thrown by NodePackageManager.resolve() when a module is resolved but its version doesn't satisfy the requested range, AND there are NO local dependency conflicts to report (conflicts==null or the conflict branch wasn't taken). This is the fallback throw at the end of the version-check block. The hint suggests the incompatible version was installed transitively. Includes the found version number if available.","triggerScenarios":"resolve() is called with a `range` option. The resolved package exists but semver.satisfies(pkg.version, range) returns false. No conflicting local dependencies are found (conflicts==null), so the code falls through past the auto-install and conflict branches to this throw. The package was likely pulled in by a transitive dependency at a different version.","commonSituations":"A Parcel plugin requires a specific version of a utility (e.g., core-js@3) but a transitive dependency installed core-js@2. The project doesn't directly list the conflicting package. npm's flat hoisting placed an older version at the top of node_modules.","solutions":["Add the package as a direct dependency in package.json with the required version range: `npm install <name>@<range>`.","Use npm overrides or yarn resolutions to force the correct version for transitive dependencies.","Audit the dependency tree with `npm ls <name>` to find which package pulls in the incompatible version.","Update the package that requires the incompatible transitive dependency to a newer version."],"exampleFix":"// before: transitive dep installs wrong version\n// parcel plugin needs core-js@^3, but node_modules has core-js@2.x\n\n// after: add as direct dependency\n// $ npm install core-js@^3.0.0","handlingStrategy":"validation","validationCode":"// Pre-check: verify installed version satisfies required range\nconst semver = require('semver');\nconst path = require('path');\n\nfunction checkInstalledVersion(name, range, projectRoot) {\n  try {\n    let pkgPath = require.resolve(path.join(name, 'package.json'), {\n      paths: [projectRoot],\n    });\n    let pkg = require(pkgPath);\n    if (!semver.satisfies(pkg.version, range)) {\n      return {ok: false, found: pkg.version, required: range};\n    }\n    return {ok: true};\n  } catch {\n    return {ok: false, error: 'not installed'};\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  let resolved = await packageManager.resolve(id, from, {range});\n} catch (e) {\n  if (e.diagnostics?.[0]?.message?.includes('Could not resolve package')) {\n    // Incompatible transitive version — add as direct dependency\n    console.error(`npm install ${name}@\"${range}\"`);\n  } else {\n    throw e;\n  }\n}","preventionTips":["Add packages with strict version requirements as direct dependencies rather than relying on transitive installation.","Use npm overrides or yarn resolutions to pin transitive dependencies to compatible versions.","Run `npm ls <name>` to trace where incompatible versions come from.","Lock down dependency versions with a lockfile and commit it."],"tags":["package-manager","transitive-dependency","semver","version-mismatch","resolution"],"backgroundTag":null,"analyzedSha":"59484858a1a0bcbb71f74088956bb437a2db6505","analyzedAt":"2026-08-13T04:06:35.925Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}