The commands npx create-react-app and npm init react-app behave differently.
Using npx create-react-app my-app --template typescript correctly creates a React app with the typescript template.
$ npx create-react-app my-app --template typescript
Creating a new React app in /home/user/my-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template-typescript...
...
Using npm init react-app my-app --template typescript (as documented at https://create-react-app.dev/docs/getting-started/#npm) does not work correctly. The --template directive is silently ignored:
$ npm init react-app my-app --template typescript
Creating a new React app in /home/user/my-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
...
Environment
Environment Info:
current version of create-react-app: 5.0.0
running from /home/royston/.npm/_npx/c67e74de0542c87c/node_modules/create-react-app
System:
OS: Linux 5.10 Ubuntu 20.04.4 LTS (Focal Fossa)
CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
Binaries:
Node: 16.14.2 - ~/.volta/tools/image/node/16.14.2/bin/node
Yarn: Not Found
npm: 8.5.0 - ~/.volta/tools/image/node/16.14.2/bin/npm
Browsers:
Chrome: Not Found
Firefox: Not Found
npmPackages:
react: Not Found
react-dom: Not Found
react-scripts: Not Found
npmGlobalPackages:
create-react-app: Not Found
The commands
npx create-react-appandnpm init react-appbehave differently.Using
npx create-react-app my-app --template typescriptcorrectly creates a React app with the typescript template.Using
npm init react-app my-app --template typescript(as documented at https://create-react-app.dev/docs/getting-started/#npm) does not work correctly. The--templatedirective is silently ignored:Environment