Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why I am getting this error - Error: EPERM: operation not permitted, mkdir 'C:\Users\Aniket' command not found: create-react-app

I have installing react app using this command

$ npx create-react-app my-app

Then I got Error like this:

Error: EPERM: operation not permitted, mkdir 'C:\Users\Aniket'
command not found: create-react-app

I have seen some online resources they are saying I have to remove space from my Windows Username, isn't there any other way of make this work?

like image 749
anoniket Avatar asked Jul 02 '20 09:07

anoniket


3 Answers

Make sure you've node>=8.10 and npm>=5.6 already installed

Try installing it globally first, using the command

npm install -g create-react-app

And then, you can create your app using the command,

npx create-react-app <Name of your app>

Hope this helps :)

Edit: Above solution might work but it's not recommended way of solving this issue. Please refer https://create-react-app.dev/docs/getting-started

I referred the solution given at bottom and some other posts to use below command: npm config set cache "C:\Users\mycomputer~1name\AppData\Roaming\npm-cache" --global

like image 129
Sahithi Venkatesan Avatar answered Nov 13 '22 18:11

Sahithi Venkatesan


Go to c:/users open command prompt and run dir /x check shorter name you found with dir/x as shown in image and run npm config set cache "C:/Users/<shortname-you-found-with-dir/x>/AppData/Roaming/npm-cache" --global

In my case it's CYBERC~1.

Configuration

this works fine in my case.

like image 22
shubham kapoor Avatar answered Nov 13 '22 18:11

shubham kapoor


The easiest way for me is:

mkdir C:\cache
npm config set cache "C:\\cache"

And then run the command again.

like image 16
Pavel Petrov Avatar answered Nov 13 '22 19:11

Pavel Petrov