Create-react-app not working

Hi there! I am having a hard time creating my first React app. I keep getting this error block when I use the command npx create-react-app. Can anyone help me get past this? I would be so grateful, thank you!

$ npx create-react-app myfirstreactapp

Need to install the following packages:

[email protected]

Ok to proceed? (y) y

npm WARN deprecated [email protected]: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.

npm ERR! code EEXIST

npm ERR! syscall mkdir

npm ERR! path /Users/lydiapurves-ware/.npm/_cacache/content-v2/sha512/12/7c

npm ERR! errno -13

npm ERR! EACCES: permission denied, mkdir ‘/Users/lydiapurves-ware/.npm/_cacache/content-v2/sha512/12/7c’

npm ERR! File exists: /Users/lydiapurves-ware/.npm/_cacache/content-v2/sha512/12/7c

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/lydiapurves-ware/.npm/_logs/2024-03-20T11_38_25_030Z-debug-0.log

1 Like

Have you tried npm instead of npx?

I’m having the same issue, did you find a solution?

** edit **
Okay so it seems that the permission thing is a common error/issue on the MacBook terminal

The solution for me was:

  • First to remove the file using sudo rm -rf + the file path. So in the case of the error above:
    sudo rm -rf /Users/lydiapurves-ware/.npm/_cacache/content-v2/sha512/12/7c

  • Then when installing create-react-app I had to use sudo before the command, to bypass the permission error, like this:
    sudo npx create-react-app myfirstreactapp

The deprecated warning (npm WARN deprecated …etc) will still happen because apparently now the React documentation says not to use create-react-app anymore (but I think the course will likely get to it later - so for now I’d ignore it)