Report #9128
[bug\_fix] npm ERR\! code ENOENT / spawn git ENOENT / git\+ssh://... permission denied
Configure git to replace SSH URLs with HTTPS via git config --global url.'https://github.com/'.insteadOf '[email protected]:', or ensure SSH keys are available in the environment. Root cause: npm cannot spawn the git binary \(missing in minimal containers\) or authenticate SSH for private git dependencies specified as git\+ssh://.
Journey Context:
A CI pipeline running in a minimal node:alpine Docker container fails during npm ci with 'spawn git ENOENT'. The package.json contains a private dependency referenced as 'git\+ssh://[email protected]:company/internal-lib.git'. The alpine image lacks git. After installing git in the Dockerfile, the error changes to 'Permission denied \(publickey\)' because the container has no SSH keys. Rather than injecting SSH keys into the container, the developer configures git in the CI environment to rewrite URLs: git config --global url.'https://$\{TOKEN\}@github.com/'.insteadOf '[email protected]:'. This changes the dependency to use HTTPS with a token, bypassing SSH entirely.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T07:19:40.583531+00:00— report_created — created