abhigyanpatwari/GitNexus · error · RuntimeError
Failed to install Node.js: {result.get('output', '')}
Error message
Failed to install Node.js: {result.get('output', '')} What it means
Thrown by GitNexusDockerEnvironment.setup inside eval/environments/gitnexus_docker.py when the container has no Node.js, the env runs the NodeSource setup_20.x bootstrap, and any of apt-get update / install curl / curl-setup / apt install nodejs returns non-zero. The message includes the captured stdout/stderr so you can see which step failed.
Source
Thrown at eval/environments/gitnexus_docker.py:128
logger.info(f"GitNexus setup completed in {self.index_time:.1f}s")
def _ensure_nodejs(self):
"""Ensure Node.js >= 18 is available in the container."""
check = self.execute({"command": "node --version 2>/dev/null || echo 'NOT_FOUND'"})
output = check.get("output", "").strip()
if "NOT_FOUND" in output:
logger.info("Installing Node.js in container...")
install_cmds = [
"apt-get update -qq",
"apt-get install -y -qq curl ca-certificates",
"curl -fsSL https://deb.nodesource.com/setup_20.x | bash -",
"apt-get install -y -qq nodejs",
]
for cmd in install_cmds:
result = self.execute({"command": cmd, "timeout": 60})
if result.get("returncode", 1) != 0:
raise RuntimeError(f"Failed to install Node.js: {result.get('output', '')}")
else:
logger.info(f"Node.js already available: {output}")
def _install_gitnexus(self):
"""Install the gitnexus npm package globally."""
check = self.execute({"command": "npx gitnexus --version 2>/dev/null || echo 'NOT_FOUND'"})
if "NOT_FOUND" in check.get("output", ""):
logger.info("Installing gitnexus...")
result = self.execute({
"command": "npm install -g gitnexus",
"timeout": 60,
})
if result.get("returncode", 1) != 0:
raise RuntimeError(f"Failed to install gitnexus: {result.get('output', '')}")
def _index_repository(self):
"""Run gitnexus analyze on the repo, using cache if available."""
repo_info = self._get_repo_info()View on GitHub (pinned to d540b00184)
Solutions
- Pre-bake Node.js 20 into the Docker image (Dockerfile: RUN the same nodesource setup at build time) so setup is a no-op at eval time.
- Ensure the eval runner has outbound internet to deb.nodesource.com and the default Ubuntu apt mirrors.
- Raise the per-step timeout in the execute() call (currently 60s) for slow networks, or set HTTP_PROXY/HTTPS_PROXY for the container.
- Point apt at a mirror reachable from the environment, or use a Node base image (e.g. swebench image variant with node preinstalled).
- Run `docker run --rm <image> bash -lc 'node -v || apt-get update'` locally to reproduce which step fails.
Example fix
# before: container image has no node, install fails at eval time
result = self.execute({'command': cmd, 'timeout': 60})
raise RuntimeError(f'Failed to install Node.js: {result.get("output", "")}')
# after: bake Node into the image (Dockerfile)
# RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && apt-get install -y nodejs Defensive patterns
Strategy: validation
Validate before calling
# Preflight: ensure Node is present in the image before invoking setup. docker run --rm "$IMAGE" bash -lc 'node -v && npm -v' \ || echo 'Need to pre-bake Node into the image; nodesource bootstrap at eval time is fragile'
Type guard
def is_node_install_failure(exc: RuntimeError) -> bool:
return 'Failed to install Node.js' in str(exc) Try / catch
try:
env._install_node()
except RuntimeError as e:
if is_node_install_failure(e):
logger.warning('Node bootstrap failed; using pre-baked image fallback')
# fall back to an image variant that already has Node
else:
raise Prevention
- Bake Node 20 into the SWE-bench image at build time.
- Confirm the eval runner has outbound access to deb.nodesource.com and the apt mirrors.
- Raise the 60s per-step timeout for slow networks, or use an HTTP proxy.
When it happens
Trigger: The SWE-bench eval container lacks Node; the bootstrap loop runs `apt-get update -qq`, `apt-get install -y -qq curl ca-certificates`, `curl -fsSL https://deb.nodesource.com/setup_20.x | bash -`, `apt-get install -y -qq nodejs`; if any of these exits non-zero within the 60s per-step timeout, RuntimeError fires.
Common situations: Container/CI has no outbound internet or a restricted apt mirror; deb.nodesource.com is unreachable or rate-limits the CI; old apt cache conflicts; 60s per-step timeout too short for slow networks; corporate proxy blocks raw apt.
Related errors
- Failed to install gitnexus: {result.get('output', '')}
- gitnexus analyze failed: {output[-500:]}
- Local semantic embeddings are unavailable: the optional embe
- ERR_DLOPEN_FAILED
- Circuit '${key}' is open; retry in ${Math.ceil(retryAfterMs
AI-assisted analysis of abhigyanpatwari/GitNexus@d540b00184 (2026-08-12).
Data as JSON: /api/errors/0eaa79e9fb8b247d.
Report an issue: GitHub.