Skip to content

Bug Fixed: Create react app won't work on Windows if there are spaces… #12780

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

TheAli711
Copy link

… in your username #6512

Added code to check if a user is on Windows platform and if the path to create react app project contains space, then console.error a helpful message, and process.exit(1)

Hey, didn't change any code, just added some new code.
This PR aims to resolve issue #6512 and provide a helpful error message to Windows users in case the path of the project contains space.
Regards,
Ali Mansoor

… in your username facebook#6512

Added code to check if user is on Windows paltform and if the path to create react app project contains space, then console.error a helpful message, and process.exit(1)
@KenACollins
Copy link

@TheAli711,

You can't consider this bug fixed just by issuing a "helpful message". That is not a solution. A Windows username containing a space cannot be easily changed to remove the space. It is better to wait years for the computer to die and consider a non-space username with the next computer purchase. Therefore, with your "helpful message" what you are saying is that Windows users in this situation cannot use npx.

The truth is, is that Windows usernames are real people's names with first and last name so there is a space between. Apple, with all its claims of user friendly design forces people to enter a username rather than their real name.

@TheAli711
Copy link
Author

TheAli711 commented Oct 16, 2022

@KenACollins
Yes you are right, showing a helpful message is not enough but the actual issue is not with CRA but rather with npm/npx, and that repo is archived, so instead of making the user track down the issue and waste time, all we can do is show a helpful message,
Kindly look at this comment

@KenACollins
Copy link

@TheAli711, Oh I see. I was missing the context. Thanks for clearing that up for me!

@ravin00
Copy link

ravin00 commented Aug 4, 2024

You can fix this by avoiding spaces in the directory names and use hyphens or underscores to avoid this error. I'll add some additional points to overcome this situation.

  1. use create-npx-react-app without and a path without any spaces
  2. use a temporary directory
  3. Set Environment Variable TMP and TEMP this means you need to specify where the temporary files need to be installed in the system

@TheAli711
Copy link
Author

@ravin00 You are correct, we should avoid spaces in folder and file names, but the issue occurs when someone already has those, and for beginners, this causes a lot of trouble as they are unaware. So instead of them having to track down this issue, we can show a helpful message so they know what is wrong. The PR is to print a helpful message after the problem has occurred.

@mrmckeb Could you kindly look into whether this can be merged?

@KenACollins
Copy link

Hi All,

As I have learned by watching this helpful video posting...

#6512 (comment)

I can confirm that simply upgrading to a more recent release of Node and npm resolves the problem. I upgraded to Node 20.15.1 which brought along npm 10.7.0 and after that, the "npx create-react-app my-app" command worked with my username "Ken A Collins" which contains two spaces.

@TheAli711 TheAli711 closed this Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create react app won't work on Windows if there are spaces in your username
3 participants