Skip to content Skip to sidebar Skip to footer

Why Can't React Project Name Contain Capital Letters?

I got the following message while trying to create a new project 'newRecipeApp' in React. npx: installed 91 in 29.359s Could not create a project called 'newRecipeApp' because of n

Solution 1:

you can read this https://github.com/facebook/create-react-app/issues/2165 NPM packages are not allowed upper case characters in their name, seemingly because unix filesystems are case-sensitive, which creates "a recipe for confusion and nonportable software".

This makes perfect sense in the context of libraries intended as portable software; however, not so much when speaking about end-of-the-line applications, especially those developed in a case-insensitive environment like Windows.

PR1652 introduced project name validation using validate-npm-package-name, assumedly to avoid issues with output displaying spaces in names.

Should "React applications", being a different (eg: less focused on "portability") category of software, have these same restrictions?

For example, I am not trying to make an npm package / library. I am trying to use create-react-app to generate an application, and I need to follow application naming conventions in my company which requires the use of capital letters in the application name.


Solution 2:

It's mostly because NPM doesn't allow capital letters. So to ensure compatibility with the naming scheme of NPM they might have done it.


Solution 3:

This is likely to reconcile naming issues between linux and OSX. Linux differentiates between dirs/files with the same names, but with capital letters and OSX does not. So imagine someone created a project in linux called WebApp and another called webapp. If they tried to download both to an OSX platform, one of these projects would be overwritten. To fix this, NPX devs probably decided to just force all directory names to lowercase so if a linux user created webapp then tried to create or download WebApp, there would be a protection against that for mac users that need to download both projects.


Post a Comment for "Why Can't React Project Name Contain Capital Letters?"