{"record":{"id":"eb937c1d803be9a5","repo":"nodejs/node","slug":"dependency-s-not-found","errorCode":null,"errorMessage":"Dependency '%s' not found","messagePattern":"Dependency '(.+?)' not found","errorType":"exception","errorClass":"GypError","httpStatus":null,"severity":"error","filePath":"tools/gyp/pylib/gyp/input.py","lineNumber":2009,"sourceCode":"    for target, spec in targets.items():\n        build_file = gyp.common.BuildFile(target)\n        build_file_node = dependency_nodes[build_file]\n        target_dependencies = spec.get(\"dependencies\", [])\n        for dependency in target_dependencies:\n            try:\n                dependency_build_file = gyp.common.BuildFile(dependency)\n            except GypError as e:\n                gyp.common.ExceptionAppend(\n                    e, \"while computing dependencies of .gyp file %s\" % build_file\n                )\n                raise\n\n            if dependency_build_file == build_file:\n                # A .gyp file is allowed to refer back to itself.\n                continue\n            dependency_node = dependency_nodes.get(dependency_build_file)\n            if not dependency_node:\n                raise GypError(\"Dependency '%s' not found\" % dependency_build_file)\n            if dependency_node not in build_file_node.dependencies:\n                build_file_node.dependencies.append(dependency_node)\n                dependency_node.dependents.append(build_file_node)\n\n    # Files that have no dependencies are treated as dependent on root_node.\n    root_node = DependencyGraphNode(None)\n    for build_file_node in dependency_nodes.values():\n        if len(build_file_node.dependencies) == 0:\n            build_file_node.dependencies.append(root_node)\n            root_node.dependents.append(build_file_node)\n\n    flat_list = root_node.FlattenToList()\n\n    # If there's anything left unvisited, there must be a circular dependency\n    # (cycle).\n    if len(flat_list) != len(dependency_nodes):\n        if not root_node.dependents:\n            # If all files have dependencies, add the first file as a dependent","sourceCodeStart":1991,"sourceCodeEnd":2027,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/tools/gyp/pylib/gyp/input.py#L1991-L2027","documentation":"In VerifyNoGYPFileCircularDependencies, gyp builds a graph at the .gyp-FILE level (not target level). For each dependency it computes the build file; if that file differs from the current file and is not already a node, it raises GypError 'Dependency not found'. This means a .gyp file references another build file that gyp never loaded as a node.","triggerScenarios":"A .gyp file's dependency list names a qualified target whose build-file component (gyp.common.BuildFile(dependency)) yields a build file with no corresponding node in dependency_nodes. Reached during the file-level graph build before the cycle check.","commonSituations":"A dependency points at a .gyp file that was not included/loaded (wrong relative path, missing include, file deleted); path normalization differences; referencing a target in a file only loaded under a disabled conditional.","solutions":["Confirm the referenced .gyp file path is correct and the file exists.","Make sure the .gyp file is actually included by the top-level build file (transitively).","Check relative-path resolution and OS path separators.","Ensure the target's declaring file is not hidden behind a false conditional."],"exampleFix":"// before: 'dependencies': ['missing.gyp:x']  // missing.gyp never loaded\n// after: add 'missing.gyp' to includes, or fix path to '../sub/missing.gyp:x'","handlingStrategy":"validation","validationCode":"import gyp.common, os\nloaded_files = set(os.path.abspath(f) for f in build_files)\nfor t, spec in targets.items():\n    bf = gyp.common.BuildFile(t)\n    for d in spec.get('dependencies', []):\n        dbf = gyp.common.BuildFile(d)\n        if dbf != bf and os.path.abspath(dbf) not in loaded_files:\n            raise SystemExit('Referenced build file not loaded: %r' % dbf)\n","typeGuard":null,"tryCatchPattern":"try:\n    gyp.main(args)\nexcept gyp.input.GypError as e:\n    if \"Dependency '\" in str(e) and 'not found' in str(e): print('Check .gyp file inclusion/paths'); raise","preventionTips":["Keep a single entry .gyp that transitively includes all needed files.","Use correct relative paths for cross-file dependencies.","Validate the include set in CI."],"tags":["gyp","dependency-graph","build-config","validation"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}