The EEXIST error occurs when npm tries to create a directory that already exists. This commonly happens during project initialization when a folder with the target name is already present.
EEXIST (Error EXISTS) is a filesystem error indicating npm tried to create a directory using mkdir() but a file or directory with that name already exists. This commonly occurs when: 1. Running `npx create-react-app my-app` when "my-app" folder exists 2. npm cache has corrupted entries 3. A previous failed installation left partial directories 4. File permission conflicts prevent proper directory operations The error prevents npm from proceeding to avoid accidentally overwriting existing content.
Delete the conflicting directory:
# Check if it exists
ls -la project-name
# Remove it
rm -rf project-name
# Retry
npx create-react-app project-nameWindows:
Remove-Item -Recurse -Force project-nameSimply choose a unique name:
# Instead of:
npx create-react-app my-app
# Use:
npx create-react-app my-app-v2
# or
npx create-next-app my-new-projectIf error shows cache path:
npm cache clean --force
npm cache verify
# Retry
npm initFor stubborn cache issues:
# Linux/macOS
rm -rf ~/.npm
# Windows
Remove-Item -Path "$env:APPDATA\npm-cache" -Recurse -Force
# Reinstall
npm cache verify
npm initKill competing npm processes:
# Linux/macOS
pkill -f npm
pkill -f node
# Windows
taskkill /IM npm.exe /F
taskkill /IM node.exe /FWait a moment, then retry.
Prevention tips:
1. Use unique, descriptive project names
2. Create parent directory first:
mkdir -p ~/projects/new-app
cd ~/projects/new-app
npm init -y3. Check before creating:
[ -d "my-app" ] && echo "Directory exists!" || npx create-react-app my-app4. Regular cache maintenance:
npm cache clean --force # Monthlynpm ERR! code E401 npm ERR! 401 Unauthorized - Token has expired
Token has expired - npm authentication failure
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 EAI_NODATA npm ERR! errno EAI_NODATA npm ERR! getaddrinfo EAI_NODATA registry.npmjs.org
How to fix "npm ERR! code EAI_NODATA - getaddrinfo EAI_NODATA"
npm ERR! code ETOOMANYARGS npm ERR! Too many arguments
How to fix "npm ERR! code ETOOMANYARGS - Too many arguments"