{"record":{"id":"fbd53a6d63142bef","repo":"angular/angular-cli","slug":"package-json-stringify-name-was-found-but-does","errorCode":null,"errorMessage":"Package ${JSON.stringify(name)} was found but does not support schematics.","messagePattern":"Package (.+?) was found but does not support schematics\\.","errorType":"exception","errorClass":"NodePackageDoesNotSupportSchematics","httpStatus":null,"severity":"error","filePath":"packages/angular_devkit/schematics/tools/node-module-engine-host.ts","lineNumber":60,"sourceCode":"          'Circular schematic reference detected: ' + JSON.stringify(Array.from(references)),\n        );\n      } else {\n        references.add(requester);\n      }\n    }\n\n    let collectionPath: string | undefined = undefined;\n    const resolveOptions = {\n      paths: requester ? [dirname(requester), ...(this.paths || [])] : this.paths,\n    };\n\n    // Try to resolve as a package\n    try {\n      const packageJsonPath = require.resolve(`${name}/package.json`, resolveOptions);\n      const { schematics } = require(packageJsonPath);\n\n      if (!schematics || typeof schematics !== 'string') {\n        throw new NodePackageDoesNotSupportSchematics(name);\n      }\n\n      // If this is a relative path to the collection, then create the collection\n      // path in relation to the package path\n      if (schematics.startsWith('.')) {\n        const packageDirectory = dirname(packageJsonPath);\n        collectionPath = resolve(packageDirectory, schematics);\n      }\n      // Otherwise treat this as a package, and recurse to find the collection path\n      else {\n        collectionPath = this.resolve(schematics, packageJsonPath, references);\n      }\n    } catch (e) {\n      if ((e as NodeJS.ErrnoException).code !== 'MODULE_NOT_FOUND') {\n        throw e;\n      }\n    }\n","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular_devkit/schematics/tools/node-module-engine-host.ts#L42-L78","documentation":"The NodeModuleEngineHost resolved the requested package successfully (require.resolve found it), but the package's package.json either lacks a \"schematics\" field or that field is not a string. The schematics field is what tells the engine which JSON collection file describes the package's schematics, so without it the package cannot be used as a schematic collection. This error is thrown from resolve() in packages/angular_devkit/schematics/tools/node-module-engine-host.ts:60 via NodePackageDoesNotSupportSchematics.","triggerScenarios":"Calling createSchematicCollection/get/create a collection whose name is a resolvable npm package, where require(`${name}/package.json`).schematics is undefined or not a string — e.g. `ng generate`/`ng add` pointed at a normal (non-schematic) npm package, or a schematics package whose package.json is missing the \"schematics\": \"./schematics.json\" entry.","commonSituations":"Running `ng add <some-package>` on a library that has no schematics support; publishing a schematics collection but forgetting the \"schematics\" key in package.json; typo'ing the field name (\"schematic\" instead of \"schematics\"); installing the wrong package (core library instead of its schematics companion package); a package.json exports map preventing `${name}/package.json` from exposing the intended file.","solutions":["Add a valid \"schematics\" entry to the package's package.json, e.g. \"schematics\": \"./schematics/collection.json\", pointing at a real JSON collection file.","Verify you installed the correct package — many libraries ship schematics in a separate package (e.g. `/schematics` variant); use that package name in your schematic/collection reference.","If using npm \"exports\", ensure \"./package.json\" is exported so require.resolve(`${name}/package.json`) and the require() read the correct file.","Double-check the field is a string (a path), not an object; fix typos like \"schematic\" or \"schematicsPath\"."],"exampleFix":"// before (package.json of the target package)\n{\n  \"name\": \"my-lib\",\n  \"version\": \"1.0.0\"\n}\n// after\n{\n  \"name\": \"my-lib\",\n  \"version\": \"1.0.0\",\n  \"schematics\": \"./schematics/collection.json\"\n}","handlingStrategy":"validation","validationCode":"const fs = require('fs');\nfunction supportsSchematics(name) {\n  try {\n    const pkg = require(require.resolve(`${name}/package.json`));\n    return typeof pkg.schematics === 'string';\n  } catch {\n    return false;\n  }\n}\nif (!supportsSchematics('my-lib')) throw new Error('package has no schematics collection');","typeGuard":"function hasSchematicsField(pkg) {\n  return typeof pkg === 'object' && pkg !== null && typeof pkg.schematics === 'string';\n}","tryCatchPattern":"try {\n  const collection = host.createCollection(name);\n} catch (err) {\n  if (err instanceof NodePackageDoesNotSupportSchematics) {\n    console.error(`${name} is not a schematics package; check its package.json \"schematics\" field`);\n  } else { throw err; }\n}","preventionTips":["Always include \"schematics\": \"./schematics/collection.json\" in any package you intend to use as a collection.","Use schematics scaffolding generators (schematics-cli blank) so the package.json wiring is correct from the start.","If the package uses npm exports, add \"./package.json\": \"./package.json\" to the exports map.","Before publishing, smoke-test with `schematics .:schematic-name` from the package root."],"tags":["angular","schematics","package-json","configuration"],"backgroundTag":"package-does-not-support-schematics","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}