facebook / create-react-app

Set up a modern web app by running one command.
https://create-react-app.dev
MIT License
102.7k 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

ansh8tu commented 3 years ago

Open your IDE's terminal and type this :

npm install -g create-react-app

Followed by: npx create-react-app <Any name that you want>

Cheers,

masfikalam 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!!!

oshadabasnayake commented 3 years ago

@Sahithi-Venkatesan thank you very much for quick advice!

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

This has helped me...many thanks

ParthKhanna07 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 Maseiah!!

Marakanz 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.

I tried this and its still showing the same error please I need your help

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

First of all, it is not a recommended solution which you can see from the official docs

I'm on Windows 10 64-bit Pro and let me explain how I made it work step by step.

Note my username for my machine is Assad Ullah Chaudhry

You got spaces in your username that's why it is not working for you

Follow the steps to make it work:

  1. Open up power shell or any command line program go into C:\Users
  2. Once you are in C:\Users, type dir /x and you should see something like this. image
  3. You can see my short name is ASSADU~1 and in your case it would be different. Now run this command npm config set cache "C:/Users/<your-shortname-goes-here>/AppData/Roaming/npm-cache" --global. With my short name, this command looks like this npm config set cache "C:/Users/ASSADU~1/AppData/Roaming/npm-cache" --global just so you know the final look of it before running it.
  4. Final step, run npx create-react-app my-app and that's it.

Hope it helps!

assadullahchaudhry 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.

I tried this and its still showing the same error please I need your help

check my reply to make it work for you. Solution to make it work

AnandBIT 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

This one worked for me. First go to C:/Users and get your truncated username from there and in cmd (admin level permission), do these

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

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

Error fixed. Thank you.

hossainchisty 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 it's working .

nmoragane 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.

Worked Thanks

zafarhussain633 commented 3 years ago

Thank you so much, It works

stevenkabari commented 3 years ago

a

you rock

ShivamSeth05 commented 3 years ago

solve the error write the command in the terminal: npm uninstall -g create-react-app && npm i -g npm@latest && npm cache clean -f Now create your react app by command: create-react-app my-app

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

plusiv 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.

It worked for me!

Myilvaganan commented 3 years ago

It worked for me at first attempt

Try installing it globally first, using the command

  1. npm install -g create-next-app

And then, you can create your app using the command,

  1. npx create-next-app
lriofrio915 commented 3 years ago

Intente instalarlo globalmente primero, usando el comando npm install -g create-react-app

Y luego, puede crear su aplicación usando el comando, npx create-react-app <Name of your app>

Espero que esto ayude :)

Excelente solución... 2021 funcionando,. mil gracias.

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

This help me tooo

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

This is perfect .. Thank you so much

ThenukaDinu 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

slower-master 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

Akintola-Stephen commented 3 years ago

Nothing here solved my issue. Am frustrated right now thou.

assadullahchaudhry commented 3 years ago

Nothing here solved my issue. Am frustrated right now thou.

@Akintola-Stephen Don't worry. Let me help you out with this :)

I'm on Windows 10 64-bit Pro and let me explain how I made it work step by step.

Note my username for my machine is Assad Ullah Chaudhry

You got spaces in your username that's why it is not working for you

Follow the steps to make it work:

  1. Open up power shell or any command-line program go into C:\Users
  2. Once you are in C:\Users, type dir /x and you should see something like this. image
  3. You can see my short name is ASSADU~1 and in your case it would be different. Now run this command npm config set cache "C:/Users/<your-shortname-goes-here>/AppData/Roaming/npm-cache" --global. With my short name, this command looks like this npm config set cache "C:/Users/ASSADU~1/AppData/Roaming/npm-cache" --global just so you know the final look of it before running it.
  4. Final step, run npx create-react-app my-app and that's it.

Hope it helps!

ankyBot 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

you saved me, thanks

ishaiknadeem commented 3 years ago

I was facing the same problem for 3 days and got this solution for it...

It's because of old files lying in your c drive:

Follow the steps below and try, It will work for sure.

problem:

npm ERR! Errno: -4048, npm ERR! code: ‘EPERM’, npm ERR! syscall: ‘scandir’,

solution:

Uninstall node with node uninstaller ( find it from run cmd )

Then...

Delete the npmrc file and delete the C:\Users\Administrator.npmrc file ( if don't find leave it )

Delete npm-cache folder from - C:\Users\Administrator\AppData\Roaming

Delete npm folder from - C:\Users\Administrator\AppData\Roaming

Restart your system and install fresh NodeJS and run this command in cmd: npm cache clean -–force to ensure the cache is cleared.

That's your ready to go now...

If you still face a problem feel free to get in touch with me @ishaiknadeem username on any platform

ElbiGans04 commented 3 years ago

such

thanks man, it's very helpful

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

It is working !! Thanks!

vishnusiju commented 3 years ago

I got the same ERROR..! I solve it, 1.Try install npm globally first, npm install -g create-react-app

  1. And then, create your app npx create-react-app <Name of the project>
Quincy-G 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..

deepakshukla89 commented 3 years ago

thank you for this

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

First of all, it is not a recommended solution which you can see from the official docs

I'm on Windows 10 64-bit Pro and let me explain how I made it work step by step.

Note my username for my machine is Assad Ullah Chaudhry

You got spaces in your username that's why it is not working for you

Follow the steps to make it work:

  1. Open up power shell or any command line program go into C:\Users
  2. Once you are in C:\Users, type dir /x and you should see something like this. image
  3. You can see my short name is ASSADU~1 and in your case it would be different. Now run this command npm config set cache "C:/Users/<your-shortname-goes-here>/AppData/Roaming/npm-cache" --global. With my short name, this command looks like this npm config set cache "C:/Users/ASSADU~1/AppData/Roaming/npm-cache" --global just so you know the final look of it before running it.
  4. Final step, run npx create-react-app my-app and that's it.

Hope it helps!

Thanks Man 🥲🥲🥲 It helped

shoaibbadshah 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

thank you I resolved my issue with this

sushma140198 commented 3 years ago

Thanks for solution for beginners in react help a lot.

Try installing it globally first, using the command npm install -g create-react-app t. And then, you can create your app using the command, npx create-react-app <Name of your app>

Hope this helps :)

Thanks a lot it working . And it will help to beginner in react.

DanChristos 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

This is the most appropriate solution for me. Thanks for sharing!

mansidhall29 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.

SAVIOUR.

Phineas98 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

firstly install globally -> npm install -g create-react-app and then type -> npx create-react-app

eneskabacaoglu commented 3 years ago

Nothing here solved my issue. Am frustrated right now thou.

@Akintola-Stephen Don't worry. Let me help you out with this :)

I'm on Windows 10 64-bit Pro and let me explain how I made it work step by step.

Note my username for my machine is Assad Ullah Chaudhry

You got spaces in your username that's why it is not working for you

Follow the steps to make it work:

  1. Open up power shell or any command-line program go into C:\Users
  2. Once you are in C:\Users, type dir /x and you should see something like this. image
  3. You can see my short name is ASSADU~1 and in your case it would be different. Now run this command npm config set cache "C:/Users/<your-shortname-goes-here>/AppData/Roaming/npm-cache" --global. With my short name, this command looks like this npm config set cache "C:/Users/ASSADU~1/AppData/Roaming/npm-cache" --global just so you know the final look of it before running it.
  4. Final step, run npx create-react-app my-app and that's it.

Hope it helps!

That worked for me. Thank you for the input.

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

Yes! This worked. Thanks a ton

Angel-Ponce commented 3 years ago

Nothing here solved my issue. Am frustrated right now thou.

@Akintola-Stephen Don't worry. Let me help you out with this :)

I'm on Windows 10 64-bit Pro and let me explain how I made it work step by step.

Note my username for my machine is Assad Ullah Chaudhry

You got spaces in your username that's why it is not working for you

Follow the steps to make it work:

  1. Open up power shell or any command-line program go into C:\Users
  2. Once you are in C:\Users, type dir /x and you should see something like this. image
  3. You can see my short name is ASSADU~1 and in your case it would be different. Now run this command npm config set cache "C:/Users/<your-shortname-goes-here>/AppData/Roaming/npm-cache" --global. With my short name, this command looks like this npm config set cache "C:/Users/ASSADU~1/AppData/Roaming/npm-cache" --global just so you know the final look of it before running it.
  4. Final step, run npx create-react-app my-app and that's it.

Hope it helps!

The dir /x command not work on power shell, use cmd

assadullahchaudhry commented 3 years ago

Nothing here solved my issue. Am frustrated right now thou.

@Akintola-Stephen Don't worry. Let me help you out with this :)

I'm on Windows 10 64-bit Pro and let me explain how I made it work step by step.

Note my username for my machine is Assad Ullah Chaudhry You got spaces in your username that's why it is not working for you Follow the steps to make it work:

  1. Open up power shell or any command-line program go into C:\Users
  2. Once you are in C:\Users, type dir /x and you should see something like this. image
  3. You can see my short name is ASSADU~1 and in your case it would be different. Now run this command npm config set cache "C:/Users/<your-shortname-goes-here>/AppData/Roaming/npm-cache" --global. With my short name, this command looks like this npm config set cache "C:/Users/ASSADU~1/AppData/Roaming/npm-cache" --global just so you know the final look of it before running it.
  4. Final step, run npx create-react-app my-app and that's it.

Hope it helps!

On power shell not work, use cmd

@Angel-Ponce make sure to close and reopen your powershell. It's a solid workaround.

Angel-Ponce commented 3 years ago

Nothing here solved my issue. Am frustrated right now thou.

@Akintola-Stephen Don't worry. Let me help you out with this :)

I'm on Windows 10 64-bit Pro and let me explain how I made it work step by step.

Note my username for my machine is Assad Ullah Chaudhry You got spaces in your username that's why it is not working for you Follow the steps to make it work:

  1. Open up power shell or any command-line program go into C:\Users
  2. Once you are in C:\Users, type dir /x and you should see something like this. image
  3. You can see my short name is ASSADU~1 and in your case it would be different. Now run this command npm config set cache "C:/Users/<your-shortname-goes-here>/AppData/Roaming/npm-cache" --global. With my short name, this command looks like this npm config set cache "C:/Users/ASSADU~1/AppData/Roaming/npm-cache" --global just so you know the final look of it before running it.
  4. Final step, run npx create-react-app my-app and that's it.

Hope it helps!

On power shell not work, use cmd

@Angel-Ponce make sure to close and reopen your powershell. It's a solid workaround.

Excuse me, my bad, I just update my comment.

Deep-Matrix-WebHero 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 Thanks a lot, it works. And it will help to a beginner in react.

Suv3ndupathak commented 3 years ago

Thanks a lot for the help.

Bethsyf 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!

Vishalll07 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.

bro can u help me in a google meet ,am stuck with this problem since months!! Please bro , it will b very kind of you, if you want i can pay u also!!

Vishalll07 commented 3 years ago

Nothing here solved my issue. Am frustrated right now thou.

@Akintola-Stephen Don't worry. Let me help you out with this :)

I'm on Windows 10 64-bit Pro and let me explain how I made it work step by step.

Note my username for my machine is Assad Ullah Chaudhry You got spaces in your username that's why it is not working for you Follow the steps to make it work:

  1. Open up power shell or any command-line program go into C:\Users
  2. Once you are in C:\Users, type dir /x and you should see something like this. image
  3. You can see my short name is ASSADU~1 and in your case it would be different. Now run this command npm config set cache "C:/Users/<your-shortname-goes-here>/AppData/Roaming/npm-cache" --global. With my short name, this command looks like this npm config set cache "C:/Users/ASSADU~1/AppData/Roaming/npm-cache" --global just so you know the final look of it before running it.
  4. Final step, run npx create-react-app my-app and that's it.

Hope it helps!

On power shell not work, use cmd

@Angel-Ponce make sure to close and reopen your powershell. It's a solid workaround.

Excuse me, my bad, I just update my comment.

bro can u help me in a google meet ,am stuck with this problem since months!! Please bro , it will b very kind of you, if you want i can pay u also!!

Vishalll07 commented 3 years ago

I was facing the same problem for 3 days and got this solution for it...

It's because of old files lying in your c drive:

Follow the steps below and try, It will work for sure.

problem:

npm ERR! Errno: -4048, npm ERR! code: ‘EPERM’, npm ERR! syscall: ‘scandir’,

solution:

Uninstall node with node uninstaller ( find it from run cmd )

Then...

Delete the npmrc file and delete the C:\Users\Administrator.npmrc file ( if don't find leave it )

Delete npm-cache folder from - C:\Users\Administrator\AppData\Roaming

Delete npm folder from - C:\Users\Administrator\AppData\Roaming

Restart your system and install fresh NodeJS and run this command in cmd: npm cache clean -–force to ensure the cache is cleared.

That's your ready to go now...

If you still face a problem feel free to get in touch with me @ishaiknadeem username on any platform

bro can u help me in google meet , i have been stuck with this problem since months, tried different solutions none worked!! please bhai ,i can pay u !! it will b very kind if u help!

abdurahmanfz commented 3 years ago

Nothing here solved my issue. Am frustrated right now thou.

@Akintola-Stephen Don't worry. Let me help you out with this :)

I'm on Windows 10 64-bit Pro and let me explain how I made it work step by step.

Note my username for my machine is Assad Ullah Chaudhry

You got spaces in your username that's why it is not working for you

Follow the steps to make it work:

  1. Open up power shell or any command-line program go into C:\Users
  2. Once you are in C:\Users, type dir /x and you should see something like this. image
  3. You can see my short name is ASSADU~1 and in your case it would be different. Now run this command npm config set cache "C:/Users/<your-shortname-goes-here>/AppData/Roaming/npm-cache" --global. With my short name, this command looks like this npm config set cache "C:/Users/ASSADU~1/AppData/Roaming/npm-cache" --global just so you know the final look of it before running it.
  4. Final step, run npx create-react-app my-app and that's it.

Hope it helps!

i cant found my shortname while dir /x. showing long name only.