Report #102870
[bug\_fix] npm ERR\! code ENOENT / npm ERR\! syscall spawn git / npm ERR\! enoent: error while executing 'git ls-remote'
Install Git on the system and ensure it is in the PATH, or change the dependency to a version that is available from the npm registry directly \(not a Git URL\).
Journey Context:
A developer tried to install a private package that was referenced as a Git dependency in package.json, e.g., "my-package": "git\+https://github.com/org/private-repo.git". On a fresh CI machine that did not have Git installed, npm install failed with an ENOENT error saying it could not spawn git. The developer assumed it was a network issue, but after checking the logs, they saw 'syscall spawn git'. They realized Git was not installed. The fix was to install Git \(e.g., 'apt-get install git' on Ubuntu, or 'brew install git' on macOS\). After that, npm install succeeded if the repository was accessible. Alternatively, they could publish the package to a private npm registry and remove the Git dependency. The root cause is that npm uses Git to fetch dependencies specified with Git URLs; if Git is missing, the spawn fails with ENOENT.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-09T15:48:22.574973+00:00— report_created — created