{"record":{"id":"5f07a56576181c07","repo":"angular/angular-cli","slug":"invalid-peer-dependency-peer-found-in-package","errorCode":null,"errorMessage":"Invalid peer dependency ${peer} found in package.","messagePattern":"Invalid peer dependency (.+?) found in package\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/angular/cli/src/commands/add/cli.ts","lineNumber":854,"sourceCode":"          );\n        }\n      }\n    }\n\n    return undefined;\n  }\n\n  private async getPeerDependencyConflicts(manifest: PackageManifest): Promise<string[] | false> {\n    if (!manifest.peerDependencies) {\n      return false;\n    }\n\n    const checks = Object.entries(manifest.peerDependencies).map(async ([peer, range]) => {\n      let peerIdentifier;\n      try {\n        peerIdentifier = npa.resolve(peer, range);\n      } catch {\n        this.context.logger.warn(`Invalid peer dependency ${peer} found in package.`);\n\n        return null;\n      }\n\n      if (peerIdentifier.type !== 'version' && peerIdentifier.type !== 'range') {\n        // type === 'tag' | 'file' | 'directory' | 'remote' | 'git'\n        // Cannot accurately compare these as the tag/location may have changed since install.\n        return null;\n      }\n\n      try {\n        const version = await this.findProjectVersion(peer);\n        if (!version) {\n          return null;\n        }\n\n        const options = { includePrerelease: true };\n        if (","sourceCodeStart":836,"sourceCodeEnd":872,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular/cli/src/commands/add/cli.ts#L836-L872","documentation":"While validating a package's peerDependencies during `ng add`, the CLI resolves each peer range with `npa.resolve`. If the peer name/range string is malformed, npm-package-arg throws and this warning is emitted; that peer is skipped. The add proceeds without that peer check.","triggerScenarios":"A dependency's package.json contains a peerDependencies entry with an invalid spec, e.g. a bad range like `\">= <<\"`, an empty range, or an unparseable name (git URL/alias syntax errors).","commonSituations":"Hand-edited or mis-published package.json; using an npm alias or prerelease tag syntax npm-package-arg cannot parse; typos in peer names in locally published/patched packages.","solutions":["Open the offending package's package.json and fix the malformed peerDependencies entry.","Pin to a version of the package that has valid peer metadata.","If the package is yours, validate the range with `npm-package-arg` before publishing.","Use `npm pkg get peerDependencies` to inspect quickly and correct the field."],"exampleFix":"// before (invalid peer)\n\"peerDependencies\": { \"@angular/core\": \">= >=16\" }\n// after\n\"peerDependencies\": { \"@angular/core\": \">=16\" }","handlingStrategy":"validation","validationCode":"try { npa.resolve(peer.name, peer.range); } catch { console.warn(`invalid peer: ${peer.name}`); }","typeGuard":"function isValidPeerSpec(spec: unknown): spec is string { return typeof spec === 'string' && !!npa.tryResolve(spec); }","tryCatchPattern":"try { peerIdentifier = npa.resolve(peer, range); } catch { logger.warn(`Invalid peer dependency ${peer}`); return null; }","preventionTips":["Validate peerDependencies with npm-package-arg before publishing packages.","Prefer well-known semver ranges over exotic specs (git URLs, aliases) in peer deps.","Audit third-party package manifests you publish internally.","Pin to released versions of packages with valid metadata."],"tags":["peer-dependencies","npm-package-arg","validation"],"backgroundTag":"invalid-package-manifest","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}