EISGIT occurs when npm detects a .git folder inside a node_modules dependency and refuses to modify it. Remove the .git folder from the problematic package or perform a clean reinstall.
npm encountered a git repository (.git folder) inside a node_modules dependency and refused to remove or replace it. npm has a long-standing safety policy of never deleting or overwriting git repositories to protect user code. This error typically occurs when a dependency was installed from a git source or contains a .git folder in its published tarball, and npm needs to update or remove that dependency.
Look at the error message to identify which package is causing the issue. The error will show a path like:
npm ERR! code EISGIT
npm ERR! path /path/to/node_modules/problematic-package
npm ERR! Appears to be a git repo or submodule.Note the exact package name for the next steps.
Navigate to the specific package's directory and remove its .git folder:
On macOS/Linux:
rm -rf node_modules/problematic-package/.gitOn Windows (PowerShell):
Remove-Item -Recurse -Force node_modules\problematic-package\.gitReplace problematic-package with the actual package name from the error message.
If multiple dependencies have .git folders, remove them all at once:
On macOS/Linux:
find node_modules -type d -name .git -exec rm -rf {} + 2>/dev/nullOn Windows (PowerShell):
Get-ChildItem -Path node_modules -Filter .git -Recurse -Force | Remove-Item -Recurse -ForceThis finds and removes all .git folders within node_modules without affecting your project's root .git folder.
Modify your package.json to use npm registry URLs instead of git sources:
Before (causes EISGIT):
{
"dependencies": {
"my-package": "git+ssh://[email protected]:user/repo.git#branch"
}
}After (uses npm registry):
{
"dependencies": {
"my-package": "^1.2.3"
}
}If removing individual .git folders doesn't resolve the issue, perform a clean reinstall:
# Remove entire node_modules directory
rm -rf node_modules
# Clear npm cache
npm cache clean --force
# Reinstall dependencies
npm installAfter resolving the issue, verify your installation is clean:
# Check if git folders still exist
find node_modules -type d -name .git
# Should return nothing if successfulThen reinstall to update your lockfile:
npm installFor package maintainers: The EISGIT error indicates your published npm package contains a .git folder, which should never be included. The .npmignore defaults should automatically exclude .git, but it may be explicitly included in your .npmignore with a negation pattern. Remove such negations. When publishing using git+ssh URLs as dependencies during development, use github: specifiers instead, which npm converts to registry URLs when publishing. For monorepo setups and workspaces, use npm workspaces with proper symbolic linking to avoid git repository conflicts.
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