facebook / create-react-app

Set up a modern web app by running one command.
https://create-react-app.dev
MIT License
102.69k stars 26.84k forks source link

Error: EPERM: operation not permitted, mkdir 'C:\Users\Vaidehi' TypeError: Cannot read property 'get' of undefined #9091

Closed vaidehishah07 closed 3 years ago

vaidehishah07 commented 4 years ago

Im trying to create a react app using command create-react-app and getting the error of, Screenshot (114)

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 () at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:80:13 at f (C:\Program Files\nodejs\node_modules\npm\node_modules\once\once.js:25:25) at afterExtras (C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:171:20) C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:97 var doExit = npm.config.loaded ? npm.config.get('_exit') : true ^

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

Sierra-034 commented 4 years ago

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

DarkDenims commented 4 years ago

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

Sahithi-Venkatesan commented 4 years ago

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 :)

ambekar92 commented 4 years ago

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 :)

Thank you, it's working ;)

gagandeepchauhan commented 4 years ago

yes its working

benittobeny34 commented 4 years ago

yeah it's working.

wakidur commented 4 years ago

@ambekar92 and @Sahithi-Venkatesan Thank you both of them. Yeah it's working properly.

hassanqamar90 commented 4 years ago

thank you, its working

sandyivan commented 4 years ago

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 :)

Thank you so much, It works

AnkhEl commented 4 years ago

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

kiranimeid commented 4 years ago

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.

AnkhEl commented 4 years ago

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 :)

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.

npx preferred
KapilShukla88 commented 4 years ago

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 :)

thanks ,it is working

VicodinAbuser commented 4 years ago

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

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

VicodinAbuser commented 4 years ago

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

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

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.

dhioputro commented 4 years ago

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 :)

OMG you helped a noob like me, thanks a lot

VicodinAbuser commented 4 years ago

@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-cache will now be cache=C:\Users\Themba~1\AppData\Roaming\npm-cache this 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

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.

manish-iitg commented 4 years ago

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 :)

Thank you so much, It works

yeah it works fine. Thanks

m-bandari commented 4 years ago

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

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

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.

Thanks. This resolved the issue.

henrique-stack commented 4 years ago

muio obrigado! funcionou bastante.

Hussains3 commented 4 years ago

@ Sahithi-Venkatesan lots of thanks

Hussains3 commented 4 years ago

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 :)

You save me

Obizim commented 4 years ago

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

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

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.

Thanks so much. This resolved the issue for me

tripathi-abhi commented 4 years ago

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

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

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.

Yeah, this is one way to get the short name. But you don't have to look for it all the time. By default, this is 6 letters followed by ~1. In my case, changing ABHI TRIPATHI to ABHITR~1 worked. Notice there are 6 letters. Since the Firstname is only 4 letters long so it also includes 2 letters of Lastname. Maybe the firstname you used was 5 letters long.

shobhitgupta1986 commented 4 years ago

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 :)

It worked. But what was the issue and how did your suggestion resolve it?

tripathi-abhi commented 4 years ago

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 :)

It worked. But what was the issue and how did your suggestion resolve it?

This method of resolving the problem is not recommended. Refer to other solutions mentioned above and try to resolve it. You can visit this https://create-react-app.dev/docs/getting-started/ to know why it's not recommended.

haroldm2598 commented 3 years ago

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 :)

THANK YOU MS @Sahithi-Venkatesan IT WORKS FOR ME NOW HEHEHE sorry for the caplocks

aishwarya07g commented 3 years ago

@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-cache will now be cache=C:\Users\Themba~1\AppData\Roaming\npm-cache this 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

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.

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

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

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.

So I tried doing this and my system is not showing any shortnames, I'm still not able to fix this! Can you help me out?

Saqibrana45 commented 3 years ago

Im trying to create a react app using command create-react-app and getting the error of, Screenshot (114)

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 () at C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:80:13 at f (C:\Program Files\nodejs\node_modules\npm\node_modules\once\once.js:25:25) at afterExtras (C:\Program Files\nodejs\node_modules\npm\lib\config\core.js:171:20) C:\Program Files\nodejs\node_modules\npm\lib\utils\error-handler.js:97 var doExit = npm.config.loaded ? npm.config.get('_exit') : true ^

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

Same here....

Saqibrana45 commented 3 years ago

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 :)

Thank You so much Sahithi mam it helps a lot

feyton commented 3 years ago

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

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

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.

Thanks so much. This resolved the issue for me

Thank you, this one worked for me. The shortname was written in all caps and using dir /x helped.

nareshkumar124343 commented 3 years ago

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 :)

thank u

nareshkumar124343 commented 3 years ago

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 :)

thank u.. command works...

cgockeln42 commented 3 years ago

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

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

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.

Thanks! That works for me as well

IronManCool001 commented 3 years ago

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

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

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.

You are my live saver thank you for this tip next time I will only use firstname when configuring windows

clemensrieder commented 3 years ago

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

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

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.

had the same problem when trying to install tailwindcss without postcss. now it works perfectly. thank you

ashwin-rao-99 commented 3 years ago

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

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

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.

Thanks. This resolved the issue.

This resolved my issue. Thanks!

yash-khandelwal commented 3 years ago

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 :)

Thanks it worked

suneelkumarr commented 3 years ago

npm install -g create-react-app then create react app it will help you definatily

anjantalatam commented 3 years ago

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

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

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.

Woww this completely works for me !! Thanks dude.

taabishmalik commented 3 years ago

hy i am trying to create a new app using npx create-react-app my-app, but i am getting an error can someone help. I have also tried as administrator but still the same error.

$ npx create-react-app my-app npm ERR! code ENOLOCAL npm ERR! Could not install from "Malik\AppData\Roaming\npm-cache_npx\3724" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Taabish Malik\AppData\Roaming\npm-cache_logs\2020-12-30T17_18_00_193Z-debug.log Install for [ 'create-react-app@latest' ] failed with code 1

monticreativos commented 3 years ago

This error is usually a problem that the "create-react-app" command is not recognized. Solution:

  1. npm install -g create-react-app
  2. npx create-react-app tunombredeaplicacion.

Remember that they must be in the root folder where you want to install the react app

bilaliqbal1 commented 3 years ago

Thanks all of you. It's working.

saravpatel commented 3 years ago

Error Analysis: Operation not permitted and Command not found in NPX Solution:

  1. Need to install create-next-app command using npm globally using terminal or cmd. npm i -g create-next-app
  2. Now run the below command it will work properly. npx create-next-app <projectName>
chitranshjain commented 3 years ago

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 :)

Thank you very much. Been hours looking for a solution to this and yours worked in the first try :) Sahithi ma'am

Youngdavid45 commented 3 years ago

Easiest solution to solving this issue is to run your cmd as an administrator. How do you run your cmd as an adm, just right click on the cmd and you will get the option.

rajuw892 commented 3 years ago

@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-cache will now be cache=C:\Users\Themba~1\AppData\Roaming\npm-cache this 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

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.

Thanku so much man it worked.

aseef0406 commented 3 years ago

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 :)

Thanks a lot :)

gaganshrivastava commented 3 years ago

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 :)

Thanks for your comment!!

kushagragangwarr commented 3 years ago

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

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

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.

Thanks it helped!!