Error: EPERM: operation not permitted, mkdir 'C:\Users\Vaidehi' TypeError: Cannot read property 'get' of undefined
Im trying to create a react app using command create-react-app and getting the error of,

MY COMMAND: (using . as i want to create the app in the current folder itself)
C:\Users\Vaidehi Shah\Desktop\MERN-ShoppingList\client> npx create-react-app .
ERROR MESSAGE:
Error: EPERM: operation not permitted, mkdir 'C:\Users\Vaidehi'
TypeError: Cannot read property 'get' of undefined
at errorMessage (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-message.js:38:39)
at errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:201:13)
at C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js:78:20
at cb (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:225:22)
at C:\Program Files\nodejs\node_modules\npm\lib\npm.js:263:24
at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:81:7
at Array.forEach (
TypeError: Cannot read property 'loaded' of undefined at exit (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:97:27) at process.errorHandler (C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:216:3) at process.emit (events.js:210:5) at process._fatalException (internal/process/execution.js:150:25) Install for [ 'create-react-app@latest' ] failed with code 7
I got this error, when I run the same command
Error: EPERM: operation not permitted, mkdir 'C:\Users{USER_NAME}' command not found: create-react-app
Bruh Same Error: EPERM: operation not permitted, mkdir 'C:\Users{USER_NAME}' command not found: create-react-app
i think it's because the user names has a character space " ", been trying to change the folder name and even user with local users and groups but it made things worse
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 :)
Try installing it globally first, using the command
npm install -g create-react-appAnd then, you can create your app using the command,
npx create-react-app <Name of your app>Hope this helps :)
Thank you, it's working ;)
yes its working
yeah it's working.
@ambekar92 and @Sahithi-Venkatesan Thank you both of them. Yeah it's working properly.
thank you, its working
Try installing it globally first, using the command
npm install -g create-react-appAnd then, you can create your app using the command,
npx create-react-app <Name of your app>Hope this helps :)
Thank you so much, It works
This error is caused by having a space in your User name (i.e the name of your machine) for instance my machine name is Themba Alex, npx has an issue when such is the case, the solution to this is to open your terminal and run this command:
npm config edit afterward go to every line that is starting with
;cache=C:\Users\Themba Alex\AppData\Roaming\npm-cache, remove the ; and remove the space on your username, write the first 6 letters and add "~1" i.e ;cache=C:\Users\Themba Alex\AppData\Roaming\npm-cache will now be cache=C:\Users\Themba~1\AppData\Roaming\npm-cache this will solve the issue
This error is caused by having a space in your User name (i.e the name of your machine) for instance my machine name is Themba Alex, npx has an issue when such is the case, the solution to this is to open your terminal and run this command: npm config edit afterward go to every line that is starting with ;cache=C:\Users\Themba Alex\AppData\Roaming\npm-cache, remove the ; and remove the space on your username, write the first 5 letters and add "~1" i.e ;cache=C:\Users\Themba Alex\AppData\Roaming\npm-cache will now be cache=C:\Users\ThembaA~1\AppData\Roaming\npm-cache this will solve the issue
this one worked for me.
Try installing it globally first, using the command
npm install -g create-react-appAnd then, you can create your app using the command,
npx create-react-app <Name of your app>Hope this helps :)
Please note this method might work but it is not the preferred method to solve this issue according to the create-react-app formal documentation we must not install this module globally. running the command npm install -g create-react-app will install create-react-app and the documentation advises us to avoid this and instead uninstall the package globally (by running npm uninstall -g create-react-app) and then resort to using npx. I have attached a picture below supporting my statement from the create-react-app documentation page: https://github.com/facebook/create-react-app . Please see my comment above highlighting the correct way to solve this issue.
Try installing it globally first, using the command
npm install -g create-react-appAnd then, you can create your app using the command,
npx create-react-app <Name of your app>Hope this helps :)
thanks ,it is working
This error is caused by having a space in your User name (i.e the name of your machine) for instance my machine name is Themba Alex, npx has an issue when such is the case, the solution to this is to open your terminal and run this command: npm config edit afterward go to every line that is starting with ;cache=C:\Users\Themba Alex\AppData\Roaming\npm-cache, remove the ; and remove the space on your username, write the first 6 letters and add
"~1"i.e;cache=C:\Users\Themba Alex\AppData\Roaming\npm-cachewill now becache=C:\Users\Themba~1\AppData\Roaming\npm-cachethis will solve the issue
After a lot of digging and coming to this, I thought this would solve my problem but it isn't solving my problem. Even after changing Firstname Lastname to Firstname~1 and to Firstname~Lastname I am getting the same error.
Error: EPERM: operation not permitted, mkdir 'C:\Users\Firstname~Lastname'
command not found: create-react-app
This error is caused by having a space in your User name (i.e the name of your machine) for instance my machine name is Themba Alex, npx has an issue when such is the case, the solution to this is to open your terminal and run this command: npm config edit afterward go to every line that is starting with ;cache=C:\Users\Themba Alex\AppData\Roaming\npm-cache, remove the ; and remove the space on your username, write the first 6 letters and add
"~1"i.e;cache=C:\Users\Themba Alex\AppData\Roaming\npm-cachewill now becache=C:\Users\Themba~1\AppData\Roaming\npm-cachethis will solve the issueAfter a lot of digging and coming to this, I thought this would solve my problem but it isn't solving my problem. Even after changing
Firstname LastnametoFirstname~1and toFirstname~LastnameI am getting the same error.Error: EPERM: operation not permitted, mkdir 'C:\Users\Firstname~Lastname' command not found: create-react-app
I found the solution to this. Instead of just changing Firstname Lastname to Firstname~1 or Firstname~Lastname , check what the short name for your Username directory is. You can do this by opening the CMD as an administrator and running dir /x in the parent folder of the folder whose short name you're trying to find. In this case since you want to know the short name to your Firstname Lastname folder, the parent folder will be C:/Users. So go to C:/Users and run dir /x. You'll find the short name of your Firstname Lastname folder. It may not necessarily be Firstname~1. In my case, it was FirstnameL~1. After this you can run npm config set cache "C:/Users/<shortname-you-found-with-dir/x>/AppData/Roaming/npm-cache" --global. Now you should be able to run npx create-react-app my-app without any issue.
Try installing it globally first, using the command
npm install -g create-react-appAnd then, you can create your app using the command,
npx create-react-app <Name of your app>Hope this helps :)
OMG you helped a noob like me, thanks a lot
@dhioputro This is not the recommended way of using create-react-app according to the React documentation and it may cause problems down the line.|
Same happened with me. I did the same, installed create-react-app globally and it started working but after a few days and a few tweaks and a few updates here and there it stopped working again.
After having to spend 2 hours digging I found this to be the more permanent solution.
This error is caused by having a space in your User name (i.e the name of your machine) for instance my machine name is Themba Alex, npx has an issue when such is the case, the solution to this is to open your terminal and run this command: npm config edit afterward go to every line that is starting with ;cache=C:\Users\Themba Alex\AppData\Roaming\npm-cache, remove the ; and remove the space on your username, write the first 6 letters and add
"~1"i.e;cache=C:\Users\Themba Alex\AppData\Roaming\npm-cachewill now becache=C:\Users\Themba~1\AppData\Roaming\npm-cachethis will solve the issueAfter a lot of digging and coming to this, I thought this would solve my problem but it isn't solving my problem. Even after changing
Firstname LastnametoFirstname~1and toFirstname~LastnameI am getting the same error.Error: EPERM: operation not permitted, mkdir 'C:\Users\Firstname~Lastname' command not found: create-react-appI found the solution to this. Instead of just changing
Firstname LastnametoFirstname~1orFirstname~Lastname, check what the short name for your Username directory is. You can do this by opening the CMD as an administrator and runningdir /xin the parent folder of the folder whose short name you're trying to find. In this case since you want to know the short name to yourFirstname Lastnamefolder, the parent folder will beC:/Users. So go toC:/Usersand rundir /x. You'll find the short name of yourFirstname Lastnamefolder. It may not necessarily beFirstname~1. In my case, it wasFirstnameL~1. After this you can runnpm config set cache "C:/Users/<shortname-you-found-with-dir/x>/AppData/Roaming/npm-cache" --global. Now you should be able to runnpx create-react-app my-appwithout any issue.
Try installing it globally first, using the command
npm install -g create-react-appAnd then, you can create your app using the command,npx create-react-app <Name of your app>Hope this helps :)Thank you so much, It works
yeah it works fine. Thanks
This error is caused by having a space in your User name (i.e the name of your machine) for instance my machine name is Themba Alex, npx has an issue when such is the case, the solution to this is to open your terminal and run this command: npm config edit afterward go to every line that is starting with ;cache=C:\Users\Themba Alex\AppData\Roaming\npm-cache, remove the ; and remove the space on your username, write the first 6 letters and add
"~1"i.e;cache=C:\Users\Themba Alex\AppData\Roaming\npm-cachewill now becache=C:\Users\Themba~1\AppData\Roaming\npm-cachethis will solve the issueAfter a lot of digging and coming to this, I thought this would solve my problem but it isn't solving my problem. Even after changing
Firstname LastnametoFirstname~1and toFirstname~LastnameI am getting the same error.Error: EPERM: operation not permitted, mkdir 'C:\Users\Firstname~Lastname' command not found: create-react-appI found the solution to this. Instead of just changing
Firstname LastnametoFirstname~1orFirstname~Lastname, check what the short name for your Username directory is. You can do this by opening the CMD as an administrator and runningdir /xin the parent folder of the folder whose short name you're trying to find. In this case since you want to know the short name to yourFirstname Lastnamefolder, the parent folder will beC:/Users. So go toC:/Usersand rundir /x. You'll find the short name of yourFirstname Lastnamefolder. It may not necessarily beFirstname~1. In my case, it wasFirstnameL~1. After this you can runnpm config set cache "C:/Users/<shortname-you-found-with-dir/x>/AppData/Roaming/npm-cache" --global. Now you should be able to runnpx create-react-app my-appwithout any issue.
Thanks. This resolved the issue.
muio obrigado! funcionou bastante.