Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 npm naming restrictions:
  *  name can no longer contain capital letters

What is the reason for this? Why is there a naming restriction in npm for capital letters?

like image 688
RunningAdithya Avatar asked Dec 03 '19 14:12

RunningAdithya


People also ask

What is npm naming restrictions?

Naming Rules Below is a list of rules that valid npm package name should conform to. package name length should be greater than zero. all the characters in the package name must be lowercase i.e., no uppercase or mixed case names are allowed. package name can consist of hyphens.

Can you rename react project?

you can first rename the folder from router to react-routing-example. then change the name from in package. json and package-lock.

How do you make a typescript react app?

To create a React App with Typescript, run the npx create-react-app command with the --template flag set to typescript , e.g. npx create-react-app my-ts-app --template typescript . Copied! If you get an error, try forcing the command to the latest version of create-react-app. Copied!


1 Answers

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.

like image 52
Mohammed Al-Reai Avatar answered Sep 29 '22 08:09

Mohammed Al-Reai