Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

anonymouse703's avatar

How to solve this error npm ERR! code EEXIST

Error upon running npm install on new project

npm ERR! code EEXIST
npm ERR! syscall mkdir
npm ERR! path /Users/user/.npm/_cacache/content-v2/sha512/75/e4
npm ERR! errno EEXIST
npm ERR! Invalid response body while trying to fetch https://registry.npmjs.org/picocolors: EACCES: permission denied, mkdir '/Users/user/.npm/_cacache/content-v2/sha512/75/e4'
npm ERR! File exists: /Users/user/.npm/_cacache/content-v2/sha512/75/e4
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

npm ERR! A complete log of this run can be found in: /Users/user/.npm/_logs/2024-09-19T02_55_54_529Z-debug-0.log

0 likes
3 replies
jlrdw's avatar
jlrdw
Best Answer
Level 75

If on linux try with sudo.

1 like
omeratayilmaz's avatar

Way 1 - As @jlrdw mentioned, try using sudo if you're on macOS or Linux. Way 2 - Run npm i --force. Way 3 - Try removing the existing node_modules folder, then run npm i.

Please or to participate in this conversation.