16

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?

peterh
  • 11,875
  • 18
  • 85
  • 108
anoniket
  • 271
  • 1
  • 2
  • 11
  • 2
    The surest fix would be to just make sure your terminal is running as administrator. You can set it as default for your terminal in advanced shortcut properties. – Chidera Ugo Jan 13 '21 at 17:30

3 Answers3

37

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

17

The easiest way for me is:

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

And then run the command again.

Pavel Petrov
  • 181
  • 1
  • 3
16

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.

shubham kapoor
  • 589
  • 6
  • 16