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?
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.
you can first rename the folder from router to react-routing-example. then change the name from in package. json and package-lock.
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!
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With