{"record":{"id":"358b934887932b9b","repo":"pnpm/pnpm","slug":"no-package-in-dependencies-358b93","errorCode":"NO_PACKAGE_IN_DEPENDENCIES","errorMessage":"None of the specified packages were found in the dependencies of any of the projects.","messagePattern":"None of the specified packages were found in the dependencies of any of the projects\\.","errorType":"exception","errorClass":"PnpmError","httpStatus":null,"severity":"error","filePath":"pnpm11/installing/commands/src/recursive.ts","lineNumber":340,"sourceCode":"            modulesDir,\n            mutation,\n            pruneDirectDependencies: opts.pruneDirectDependencies,\n            rootDir,\n            update: opts.update,\n            updateMatching: opts.updateMatching,\n            updatePackageManifest: opts.updatePackageManifest,\n            updateToLatest: opts.latest,\n          } as MutatedProject)\n      }\n    }))\n    if (!opts.selectedProjectsGraph[opts.workspaceDir as ProjectRootDir] && manifestsByPath[opts.workspaceDir as ProjectRootDir] != null) {\n      mutatedImporters.push({\n        mutation: 'install',\n        rootDir: opts.workspaceDir as ProjectRootDir,\n      })\n    }\n    if ((mutatedImporters.length === 0) && cmdFullName === 'update' && opts.depth === 0) {\n      throw new PnpmError('NO_PACKAGE_IN_DEPENDENCIES',\n        'None of the specified packages were found in the dependencies of any of the projects.')\n    }\n    const {\n      updatedCatalogs,\n      updatedProjects: mutatedPkgs,\n      ignoredBuilds,\n      newLockfile,\n      resolutionPolicyViolations,\n      dryRunResult,\n    } = await mutateModules(mutatedImporters, {\n      ...installOpts,\n      storeController: store.ctrl,\n      resolutionVerifiers: store.resolutionVerifiers,\n    })\n    if (opts.save !== false && !opts.dryRun) {\n      // Only pick entries when we'll actually persist. Otherwise the\n      // info log would claim entries were added that the workspace\n      // manifest never saw, and the next install would re-prompt or","sourceCodeStart":322,"sourceCodeEnd":358,"githubUrl":"https://github.com/pnpm/pnpm/blob/5b11d3a15b9022a2109cb18ed96a5d652630371f/pnpm11/installing/commands/src/recursive.ts#L322-L358","documentation":"Recursive (workspace-wide) update pre-flight: after building mutatedImporters from the selected projects, none of the selected projects would receive an update mutation. For `update` at the default depth 0 this means the requested specs matched no project's direct dependencies anywhere, so the command aborts before running anything rather than reporting a silent no-op.","triggerScenarios":"`pnpm -r update <spec>` (cmdFullName === 'update', opts.depth === 0) where mutatedImporters ends up empty because no selected project's direct dependencies match the spec — misspelled name, package absent from every manifest, or --filter selecting projects that don't depend on it.","commonSituations":"Typo in the package name; assuming a dep is somewhere in the monorepo when it was removed or lives only in the lockfile; --filter patterns that exclude the projects that actually depend on the package.","solutions":["Find which workspace projects actually depend on it: `pnpm why <pkg>` or `pnpm -r ls <pkg>`, and fix the spec spelling.","Widen or fix the --filter selection so projects that have the dependency are included.","If the dependency is only transitive, run with `--depth <N>` (depth 0 is what turns the no-match into an error).","If you intended an install rather than an update of a new package, use `pnpm -r add <pkg>`."],"exampleFix":"# before\npnpm -r update lodash-es   # ERR_PNPM_NO_PACKAGE_IN_DEPENDENCIES (no project has it)\n# after — find the owner, then target it\npnpm why lodash-es\npnpm --filter my-app update lodash-es","handlingStrategy":"validation","validationCode":"import { readFile } from 'node:fs/promises'\n\nasync function anyProjectDependsOn (projectDirs: string[], name: string): Promise<boolean> {\n  for (const dir of projectDirs) {\n    const manifest = JSON.parse(await readFile(`${dir}/package.json`, 'utf8'))\n    const has = ['dependencies', 'devDependencies', 'optionalDependencies']\n      .some(field => manifest[field] != null && name in manifest[field])\n    if (has) return true\n  }\n  return false\n}\n\nif (!(await anyProjectDependsOn(selectedDirs, specName))) {\n  throw new Error(`no selected project depends on ${specName}`)\n}","typeGuard":"import util from 'node:util'\n\nfunction isRecursiveNoPackageError (err: unknown): boolean {\n  return util.types.isNativeError(err) && 'code' in err && (err as { code?: string }).code === 'NO_PACKAGE_IN_DEPENDENCIES'\n}","tryCatchPattern":"try {\n  await recursive(['update', spec], opts)\n} catch (err) {\n  if (isRecursiveNoPackageError(err)) {\n    // fix spec/filter or add --depth before retrying; a bare retry will fail again\n  } else {\n    throw err\n  }\n}","preventionTips":["Generate recursive update lists from workspace manifests rather than static name lists.","Prefer `pnpm --filter <owner> update <pkg>` once you know which project owns the dependency.","Remember: depth 0 + no match anywhere = hard error by design, not a no-op."],"tags":["recursive","update","workspace","dependencies"],"backgroundTag":null,"analyzedSha":"5b11d3a15b9022a2109cb18ed96a5d652630371f","analyzedAt":"2026-08-16T13:18:59.198Z","schemaVersion":2},"datasetVersion":"2026-08-16T18:17:16.020Z"}