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?

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

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

Solution 2

The easiest way for me is:

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

And then run the command again.

Solution 3

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.

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

this works fine in my case.

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply