{"record":{"id":"71698053f9247325","repo":"parcel-bundler/parcel","slug":"could-not-find-module-name-satisfying-range","errorCode":null,"errorMessage":"Could not find module \"${name}\" satisfying ${range}.","messagePattern":"Could not find module \"(.+?)\" satisfying (.+?)\\.","errorType":"exception","errorClass":"ThrowableDiagnostic","httpStatus":null,"severity":"error","filePath":"packages/core/package-manager/src/NodePackageManager.js","lineNumber":380,"sourceCode":"      if (range != null) {\n        let pkg = resolved.pkg;\n        if (pkg == null || !semver.satisfies(pkg.version, range)) {\n          let conflicts = await getConflictingLocalDependencies(\n            this.fs,\n            name,\n            from,\n            this.projectRoot,\n          );\n\n          if (conflicts == null && options?.shouldAutoInstall === true) {\n            this.invalidate(id, from);\n            await this.install([{name, range}], from);\n            return this.resolve(id, from, {\n              ...options,\n              shouldAutoInstall: false,\n            });\n          } else if (conflicts != null) {\n            throw new ThrowableDiagnostic({\n              diagnostic: {\n                message: md`Could not find module \"${name}\" satisfying ${range}.`,\n                origin: '@parcel/package-manager',\n                codeFrames: [\n                  {\n                    filePath: conflicts.filePath,\n                    language: 'json',\n                    code: conflicts.json,\n                    codeHighlights: generateJSONCodeHighlights(\n                      conflicts.json,\n                      conflicts.fields.map(field => ({\n                        key: `/${field}/${encodeJSONKeyComponent(name)}`,\n                        type: 'key',\n                        message: 'Found this conflicting local requirement.',\n                      })),\n                    ),\n                  },\n                ],","sourceCodeStart":362,"sourceCodeEnd":398,"githubUrl":"https://github.com/parcel-bundler/parcel/blob/59484858a1a0bcbb71f74088956bb437a2db6505/packages/core/package-manager/src/NodePackageManager.js#L362-L398","documentation":"Thrown by NodePackageManager.resolve() when a module is found but its version doesn't satisfy the requested range, AND getConflictingLocalDependencies finds conflicts in package.json. Unlike error [66] (module not installed at all), this means the module IS installed but at an incompatible version, and the conflict prevents auto-install from fixing it. The code reaches this branch only when conflicts!=null and the version check fails.","triggerScenarios":"resolve() is called with a specific `range` option. The resolved package version doesn't satisfy that range. getConflictingLocalDependencies returns conflicts, meaning other entries in package.json constrain the version differently. The code checks `conflicts != null` and throws with a codeframe showing the conflicting package.json field.","commonSituations":"Package A requires lodash@^3 while package.json pins lodash@^4. A transitive dependency needs an older version of a shared lib. Lock file and package.json disagree after a failed or partial install. Manually editing package.json version ranges without reinstalling.","solutions":["Align version ranges in package.json so all dependencies requesting the same package use compatible semver ranges.","Update the conflicting package to a version that supports the required dependency version.","Use npm overrides / yarn resolutions / pnpm overrides to force a compatible version.","Remove the lockfile and node_modules, then reinstall."],"exampleFix":"// before: package.json conflicts\n// \"dependencies\": { \"pkg-a\": \"^1.0.0\" }  // needs lodash@^3\n// \"devDependencies\": { \"lodash\": \"^4.0.0\" }\n\n// after: align versions\n// \"dependencies\": { \"pkg-a\": \"^2.0.0\" }  // now supports lodash@^4\n// \"devDependencies\": { \"lodash\": \"^4.0.0\" }","handlingStrategy":"validation","validationCode":"// Check version compatibility before resolving\nconst semver = require('semver');\n\nasync function checkVersionCompatibility(packageManager, name, range, from) {\n  try {\n    let {pkg} = await packageManager.resolve(name, from);\n    if (pkg && !semver.satisfies(pkg.version, range)) {\n      throw new Error(`${name}@${pkg.version} does not satisfy ${range}`);\n    }\n  } catch (e) {\n    // resolve itself may throw — handle separately\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('satisfying')) {\n    // Version mismatch with local conflicts — align ranges in package.json\n    console.error('Align version ranges in package.json for:', id);\n  } else {\n    throw e;\n  }\n}","preventionTips":["Keep all dependency version ranges consistent across package.json fields.","Use `npm ls <package>` to inspect which versions are installed and why.","When adding a new dependency, check its peerDependencies for version constraints.","Run `npm outdated` regularly to identify version drift."],"tags":["package-manager","version-conflict","semver","dependency-resolution","package-json"],"backgroundTag":null,"analyzedSha":"59484858a1a0bcbb71f74088956bb437a2db6505","analyzedAt":"2026-08-13T04:06:35.925Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}