facebook / create-react-app

Set up a modern web app by running one command.
https://create-react-app.dev
MIT License
102.75k stars 26.86k forks source link

Trouble in create-react-app in my local environment #13495

Open Duraiiii opened 10 months ago

Duraiiii commented 10 months ago

MacBook-Pro ~ % npx create-react-app my-app

Creating a new React app in /Users/Durai/my-app.

Installing packages. This might take a couple of minutes. Installing react, react-dom, and react-scripts with cra-template...

npm ERR! code EEXIST npm ERR! syscall mkdir npm ERR! path /Users/Durai/.npm/_cacache/content-v2/sha512/6d/ff npm ERR! errno EEXIST npm ERR! Invalid response body while trying to fetch https://registry.npmjs.org/scheduler: EACCES: permission denied, mkdir '/Users/Durai/.npm/_cacache/content-v2/sha512/6d/ff' npm ERR! File exists: /Users/Durai/.npm/_cacache/content-v2/sha512/6d/ff 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/Durai/.npm/_logs/2024-01-13T12_30_16_019Z-debug-0.log

Aborting installation. npm install --no-audit --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.

MohitKambli commented 10 months ago

Hello, Did you try the suggested solutions of following link: https://stackoverflow.com/questions/64870344/getting-trouble-to-create-a-new-react-app

LanreFasuyi commented 10 months ago

First of all, ensure that npm registry is properly set. You can check the current registry by using the following command: >> npm config get registry Typically you would want to set your npm registry to official npm registry using:>>
npm config set registry https://registry.npmjs.org/

Duraiiii commented 10 months ago

Problem resolved with sudo code. Thankyou.

nikky1731 commented 8 months ago

Hi, can you help me with the solution you have used. im getting the same issue in my mac

Duraiiii commented 7 months ago

Hi, can you help me with the solution you have used. im getting the same issue in my mac

You need to put 'sudo' before the command line. For example: sudo npx create-react-app your-app

Then, Enter your machine user login password for giving 'EACCES: permission' to mkdir. Then you can successfully create your react app. This is one of the easiest way and there are other ways to do the same. Make your user profile as admin.