Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upCreate react app won't work on Windows if there are spaces in your username #6512
Comments
keir
mentioned this issue
|
It sounds like all we can do is display a more helpful error message in this case (until the bug is fixed in npm/npx). Would you be interested in submitting a PR to do that? Also, do you know what happens if you try this with yarn? I don't have a Windows 10 machine to test on. If yarn works we could suggest that as a workaround. |
|
I can confirm that pretty much the same thing happens with yarn. Looks like this:
|
|
Thanks for investigating that. It's too bad we can't offer Yarn as a workaround. Is there an open issue related to this in Yarn? If not could you create one? |
|
There's no issue for this created on Yarn. I'll create one |
|
@Kacppian Thanks. Please link to the issue here. Would anyone like to make a PR to add a friendlier error message in Create React App? |
|
I'd love to! |
|
Great! It's all yours. |
|
having the same issue |
|
Hey @Kacppian are you still planning to tackle this? If not, I'd love to make a quick PR for it sometime this week. |
|
Refer to zkat/npx#181 (comment) for those who need a "right now" fix. |
|
Hey @ryandrew14, please do so. |
|
Has this still not been fixed ? |
|
Today I encountered a similar issue with npx create-react-app my-app(mkdir failed). Reason for my error
How I fixed it
And that got executed successfully. Hope this helps. |
|
Thanks, @malhar234! Worked perfectly. |
|
Thanks Malhar it worked for me too. Its been very frustrating |
|
Thank you @malhar234 |
|
Unfortunately, npx still seems to have issues for windows users (Windows account user manager enforces First Name, Last name paradigm which makes it a real problem). Switching to trusted npm install. |
U are a true legend m8 :) |
You are awesome <3 |
Lifesaver! |
|
What @malhar234 suggested worked! I had the same problem with a Next.js app. Running create-next-app --example with-zones with-zones-appinstead of: yarn create next-app --example with-zones with-zones-app |
thanks so much.. it worked for me.. am using windows 10 |
|
In case if any one facing this issue while creating react native project. You can change the location of npm-cache globally to overcome this issue as a workaround. By running the below command(Make sure the new location does not contain any white spaces)
|
Based God my dude, thanks! |
|
Referenced by zkat/npx#146 (comment) npm config set cache "C:\Users\Firstname~1\AppData\Roaming\npm-cache" --global |
|
I just solved this problem by referring to a note from one of the React communities (written by Syamlal CM) After installing node.js: First step, It worked for me. I use window 10. |
|
I still had this problem on Windows 10, but I finally found a solution that worked for me.
After that, when I run |
|
It's Important... |
|
I had the same problem and this worked for me
Both npx and npm works fine afterwards |
It works even for npx degit |
|
Thanks @malhar234 :) |
|
Folks and @malhar234 , I had the same problem I solved this problem when I 'Set-ExecutionPolicy' using Power Shell. If your ExecutionPolicy is Restricted you cannot run this. (PowerShell security policy to prevent malicious scripts from being improperly executed on your system). You can discover out you ExecutionPolicy usinng Get-ExecutionPolicy on Power Shell. After 'Set-ExecutionPolicy Unrestricted' on Power Shell I could run 'npx create-react-app myprojetc' using 'Visual Studio Code''s Terminal (for example) and it worked normally |
|
I tried all this workarounds but the only which work for me is this fix Just by run the on terminal: npm config set cache C:\tmp\nodejs\npm-cache --global |
|
Solution 1: Solution 2: If you've previously installed obviously the error occur because of the space between username
adding I will use If the name is greater than 6 letters for example: Run this command, for me it looks like this Then you can run |
this is the error it's showing. |
|
@sidrakshe28, You have to first install create-react-app using and by seeing the name of robofriends, if i am not wrong then you are doing this project from andrei Neagoie course related to Web Development. I had the same issue and it gets solved from my previous answer! |
|
issue solved successfully.thank you. |
Just run cmd in administrative mode and it will work perfectly.. |
|
|
Hey @iansu is this issue still open? I can do a quick fix as described here if not!
|
malhar you da MAN! :) thanks a lot for this ! :D |
|
Thank you @malhar234 |
|
This problem was reported a year and a half ago in Feb 2019 and still in Aug 2020 there is no fix to npx! I just upgraded to the latest LTS version of Node.js which is 12.18.3 which came with npm 6.14.6 and npx 6.14.6 and still the problem persists. This is unfortunate since the workaround to just stick with a global install of create-react-app is the old approach circa 2017. In 2020, we should be able to benefit from the npx command which does not require a separate install of create-react-app. Installing create-create-app globally causes it to get stuck on a version that is not up to date. |
|
Yup still running into the same issue. |
You sir are a legend. |
Thanks! |
|
Hey Everyone, Stop quoting malhar234's solution. It is not a solution. It is just the old way of creating a React app before npx was introduced. There is still no npx fix. |
PoojaDurgad
mentioned this issue
|
The above solution recommends installing globally, but there's no need to unless you want to have the command available generally on the path. I prefer not to have tools cluttering the global area if they are not needed. For a local setup simply run:
Then:
It's strange that there aren't enough Windows developers using NPM where this type of thing hasn't been resolved by now. It's also strange how spaces in the path has been a thorn in the side for all sorts of programs for decades. |
|
@malhar234 Thank you so much!! I tried so many ways to rename my user folder and was just about to create a new user and copy over all my files to fix this issue! Your solution works perfectly! |


tl;dr - zkat/npx#100 is an issue for create-react-app since all Windows 10 users with a space in their name won't be able to use create-react-app (unless they rename their user account home directory, a heavy process). It is not a friendly experience to dig around the internet to find the above-mentioned npx bug. Details below.
Is this a bug report?
Yes. Bug is with downstream dependency (npx and node) but it directly affects create-react-app.
Did you try recovering your dependencies?
No, because the bug happens even before I can start anything.
Which terms did you search for in User Guide?
"windows"
Environment
Windows 10 Professional
When I try to collect platform information, here is what I get (inside cmdr):
Steps to Reproduce
I posted these steps to the npx repository upstream bug:
zkat/npx#100 (comment)
Steps:
npx create-react-app my-app; it fails with the mentionedEPERMerror (below).npm init react-app my-app, alternate command mentioned on the Create React App README; same error (below).This is the error:
All Windows users with a space in their filename will encounter this issue. It looks like there was some movement at zkat/npx#181 , but then the work tailed off and wasn't merged. Perhaps if the proper fix can't get completed anytime soon, a more informative message could get printed when the problem is detected.
Expected Behavior
Create react app creates an app.
Actual Behavior
The error message shown above.
Reproducible Demo
Since this is an OS issue, just get Windows 10, make a user with spaces in the name like "Jane Doe", then try doing the first 3 commands in the create react app guide.