Report #36406
[bug\_fix] npm ERR\! code ENOENT npm ERR\! syscall spawn git npm ERR\! path git
Install Git on the target system and ensure the git executable directory is included in the system PATH environment variable, or replace Git URL dependencies in package.json with published npm registry versions.
Journey Context:
A developer defines a dependency using a Git URL format in package.json: "my-lib": "github:user/repo\#main" or "git\+https://github.com/user/repo.git". This works on their local development machine which has Git installed. However, when the CI pipeline runs in a minimal Docker container \(such as node:alpine\) or on a fresh virtual machine, npm install fails with ENOENT spawn git. The developer examines the error log and notices that npm is attempting to execute the git binary to clone the repository, but the binary is not found in the container's PATH. Installing Git in the CI environment \(e.g., apk add --no-cache git in Alpine Linux\) resolves the issue. This occurs because npm handles Git-hosted dependencies by spawning a child process running the git executable to perform clone operations; if the git binary is absent from the system's executable PATH, the operating system returns ENOENT \(Error NO ENTry\) indicating the file or directory was not found.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T15:35:15.709220+00:00— report_created — created