Open RoystonS opened 2 years ago
We're seeing this issue too.
We can't use the npx
method because were using the --scripts-version
tag (ignored by npx) to specify an older version of CRA/react-scripts.
yarn create react-app
will observe the --template
switch (and the --scripts-version
switch) correctly, but that's an extra barrier to entry; not all users will necessarily have Yarn installed.
Adding --
seems to work:
- npm init react-app . --scripts-version=my-scripts --template=my-template
+ npm init react-app . -- --scripts-version=my-scripts --template=my-template
+ npm init react-app . -- --scripts-version my-scripts --template my-template # (equals-sign or space both seem to work)
The commands
npx create-react-app
andnpm init react-app
behave differently.Using
npx create-react-app my-app --template typescript
correctly 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--template
directive is silently ignored:Environment