nodejs/node · error · GypError

%s not found (cwd: %s)

Error message

%s not found (cwd: %s)

What it means

Raised as a GypError by LoadOneBuildFile when the specified .gyp build file path does not exist on disk. The path is checked with os.path.exists before any read attempt; failure means gyp was pointed at a file (or an include) that isn't there, and the current working directory is included to help diagnose relative-path issues.

Source

Thrown at tools/gyp/pylib/gyp/input.py:230

            kp.append(repr(index))
            children.append(CheckNode(child, kp))
        return children
    elif isinstance(node, ast.Str):
        return node.s
    else:
        raise TypeError(
            "Unknown AST node at key path '" + ".".join(keypath) + "': " + repr(node)
        )


def LoadOneBuildFile(build_file_path, data, aux_data, includes, is_target, check):
    if build_file_path in data:
        return data[build_file_path]

    if os.path.exists(build_file_path):
        build_file_contents = open(build_file_path, encoding="utf-8").read()
    else:
        raise GypError(f"{build_file_path} not found (cwd: {os.getcwd()})")

    build_file_data = None
    try:
        if check:
            build_file_data = CheckedEval(build_file_contents)
        else:
            build_file_data = eval(build_file_contents, {"__builtins__": {}}, None)
    except SyntaxError as e:
        e.filename = build_file_path
        raise
    except Exception as e:
        gyp.common.ExceptionAppend(e, "while reading " + build_file_path)
        raise

    if not isinstance(build_file_data, dict):
        raise GypError("%s does not evaluate to a dictionary." % build_file_path)

    data[build_file_path] = build_file_data

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Verify the build file path exists (use the cwd shown in the message to resolve relative paths).
  2. Run gyp from the correct working directory or use absolute/canonical paths.
  3. Fix any include/dependencies references in .gyp/.gypi files to point at existing files.
  4. Check for case-sensitivity or path-separator issues (especially cross-platform).

Example fix

# before — wrong path / wrong cwd
gyp --depth=. build/notthere.gyp
# after
gyp --depth=. build/real_target.gyp
Defensive patterns

Strategy: validation

Validate before calling

import os
if not os.path.exists(build_file_path):
    raise FileNotFoundError(f'{build_file_path} not found (cwd: {os.getcwd()})')

Type guard

import os
def build_file_exists(p) -> bool:
    return os.path.exists(p)

Prevention

When it happens

Trigger: Gyp tries to load a build file (directly or via an include) whose path does not resolve. os.path.exists returns False at input.py:227, raising with the path and os.getcwd().

Common situations: Wrong --depth or build file argument; an include path in a .gyp/.gypi pointing to a moved/deleted file; running gyp from the wrong working directory so relative paths break; case-sensitivity mismatch on case-sensitive filesystems.

Related errors


AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13). Data as JSON: /api/errors/e6d5b5829a3c9828. Report an issue: GitHub.