npm git dependency error 📦 npm

npm ERR! code 128 — An unknown git error occurred (git dependency install)

npm failed to fetch a dependency that points to a Git repository.

Seen on: npm

Meaning

Git-URL dependencies need git installed and access to the repo (SSH keys or tokens). CI images often lack either.

Common causes

  • git not installed in the environment
  • No access to the private repo (SSH key/token)
  • git+ssh URL in an environment with only HTTPS access

⚡ Quick fix

  1. Install git in the image
  2. Provide credentials (deploy key or token)
  3. Switch to git+https with a token, or publish the package to a registry

Detailed fix by platform

npm

  1. "dependency": "git+https://${GITHUB_TOKEN}@github.com/acme/lib.git#v1.2.0"

How to diagnose

  1. Git — Installed?
  2. Access — Can you clone the URL manually?

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.