0

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

Ojage S
  • 27
  • 6
  • 1
    Is CRA installed? Installed globally? – Drew Reese May 28 '20 at 08:06
  • 1
    @DrewReese Global installation of CRA isn't recommended as [using npx will make sure latest version of CRA is used](https://create-react-app.dev/docs/getting-started/#quick-start). – Ajeet Shah May 28 '20 at 15:30
  • 1
    You are getting `EPERM` error. Check [npm - EPERM: operation not permitted on Windows](https://stackoverflow.com/questions/34600932/npm-eperm-operation-not-permitted-on-windows) – Ajeet Shah May 28 '20 at 15:31
  • 1
    @AjeetShah Shoot, you're right. It's been a while since I needed to run CRA. My question was based only on `command not found: create-react-app` message. – Drew Reese May 28 '20 at 15:38

3 Answers3

1

This is a bug within npm if you have your username as "FirstName LastName"

A quick fix for this is -

If your UserName is - Anand Chavan all you need to use at is ANANDC~1. i.e FirstName+First_Letter_of_your LastName+~1 (All in capital)

npm config set cache "C:\Users\<UserNameWorkAround>\AppData\Roaming\npm-cache" --global

Example config for - Anand Chavan as username.

npm config set cache "C:\Users\ANANDC~1\AppData\Roaming\npm-cache" --global
Anand Chavan
  • 4,268
  • 4
  • 20
  • 25
0

I faced the same issue as well in Windows. And I solved it as below:

It may be due to your username having space in between your username. If so, kindly try this in your command prompt if you're using Windows: npm config set cache "C:\Users\Your Name\AppData\Roaming\npm-cache" --global

Thereafter, try again: npx create-react-app awesome

0

I encountered EPERM errors while trying to clean install create-react-app and running an older version of it.

Excluding the node_modules folder from Windows' Virus & Threat Protection (answer found here) and then running my terminal as an administrator fixed it for me.

Aaron Summers
  • 126
  • 1
  • 10