This error occurs when npm attempts to clone a git repository during dependency installation but git cannot locate the repository at the specified URL. This suggests either the URL is wrong, the repository doesn't exist, or you lack permissions.
This error occurs when npm attempts to clone a git repository during dependency installation but git cannot locate the repository at the specified URL. Unlike authentication errors, this suggests either: 1. The URL is wrong (typos, incorrect format) 2. The repository doesn't exist at that location 3. You lack sufficient permissions to see the repository (which git treats as "not found") Important: Git hosting platforms like GitHub intentionally return "not found" for private repositories you can't access, to avoid leaking information about which private repositories exist. This means "repository not found" often actually means "permission denied" for private repos.
Check your package.json and verify the git URL is correct:
Valid formats:
- GitHub: https://github.com/OWNER/REPO or git+https://github.com/OWNER/REPO.git
- SSH: git+ssh://[email protected]/OWNER/REPO.git
- Shorthand: github:OWNER/REPO
Invalid formats (remove if present):
- https://github.com/OWNER/REPO/tree/main (branch reference for UI, not git)
- git://github.com/OWNER/REPO (git:// protocol may be blocked)
Check exact capitalization and spelling.
Visit the repository URL in a web browser to confirm:
- The repository exists and hasn't been deleted
- You can access it (may require login for private repos)
- The owner and repository names are spelled correctly
For GitHub: https://github.com/OWNER/REPO
Check the exact capitalization against the URL in your package.json.
Try cloning the repository manually:
git clone https://github.com/OWNER/REPO.gitIf this succeeds, the issue is npm-specific.
If this fails with "repository not found", it's a git/authentication issue.
For SSH URLs:
ssh -T [email protected]This should respond with "Hi username! You've successfully authenticated."
Private repositories require proper authentication:
Option A: Use Personal Access Token (HTTPS)
{
"dependencies": {
"my-package": "git+https://TOKEN:[email protected]/OWNER/REPO.git"
}
}Option B: Use SSH with Deploy Keys
1. Add an SSH key as a deploy key in repository settings
2. Configure ~/.ssh/config
3. Update package.json:
{
"dependencies": {
"my-package": "git+ssh://[email protected]/OWNER/REPO.git"
}
}Outdated cached credentials can cause "repository not found" errors:
Windows:
1. Open Control Panel > Credential Manager
2. Find entries for github.com
3. Delete git-related credentials
4. Run npm install again
macOS:
1. Open Keychain Access
2. Search for "github"
3. Delete expired/incorrect credentials
Linux:
git config --global --unset credential.helperIf git:// URLs fail but https:// works, configure git to use HTTPS:
git config --global url."https://github.com/".insteadOf [email protected]:
git config --global url."https://".insteadOf git://Update package.json to use explicit git+https://.
Authentication vs. Authorization: Git distinguishes between "I can't authenticate you" (403) and "the repository doesn't exist" (404). GitHub returns 404 for private repositories you can't access to avoid leaking information about which private repos exist.
Git Protocol Trade-offs:
- git:// - Fastest, read-only, often blocked by firewalls
- ssh:// - Requires SSH key setup, works in restricted networks
- https:// - Works everywhere, supports token authentication
Repository Case Sensitivity: GitHub treats repository names as case-insensitive in URLs but returns the exact case. Always verify the exact capitalization.
npm ERR! code ENOAUDIT npm ERR! Audit endpoint not supported
How to fix "npm ERR! code ENOAUDIT - Audit endpoint not supported"
npm ERR! code EBADDEVENGINES npm ERR! devEngines.runtime incompatible with current node version
How to fix "npm ERR! code EBADDEVENGINES - devEngines.runtime incompatible with current node version"
npm ERR! code ETOOMANYARGS npm ERR! Too many arguments
How to fix "npm ERR! code ETOOMANYARGS - Too many arguments"
npm ERR! code EINVALIDTAGNAME npm ERR! Invalid tag name: tag names cannot contain spaces
How to fix "npm ERR! code EINVALIDTAGNAME - tag names cannot contain spaces"
npm ERR! code E400 npm ERR! 400 Bad Request
How to fix "npm ERR! code E400 - 400 Bad Request" error