7

I need to run up a sandbox React app with version 16 and typescript.

Does anyone know how to do that as npx create-react-app --template=typescript blah now uses React 17?

Update

As suggested in the comments I've attempted to install with this:

npm init react-app migration-calculator-npm-demo --scripts-version 3.4.4

and

npm init react-app migration-calculator-npm-demo --template typescript --scripts-version 3.4.4

3.4.4 looks like the last version of react-scripts since before the major update.

Unfortunately, I'm getting errors with both.

internal/modules/cjs/loader.js:1088
throw err; ^

Error: Cannot find module 'cra-template'

and

internal/modules/cjs/loader.js:1088
throw err; ^

Error: Cannot find module 'cra-template-typescript'

5
  • 1
    Does this answer your question? How to use create-react-app with an older React version? Commented Nov 3, 2020 at 14:16
  • I'll see if that does the trick, cheers. Commented Nov 3, 2020 at 15:01
  • @radovix Do you know what version of react-scripts should be used now? Commented Nov 3, 2020 at 15:17
  • Not really. Sorry. Commented Nov 4, 2020 at 17:00
  • Have you tried to install the app like you would normally and then change the react version in the package.json, then re install the dependencies? Commented Jan 30, 2021 at 8:45

2 Answers 2

1

npx create-react-app blah uses the version you have installed. If you have react package version 16 installed, then it will use version 16. You can also run a specific react-script version: Example: sudo npm init react-app my-app --scripts-version 3.4.0, Source

Sign up to request clarification or add additional context in comments.

6 Comments

Do you know what version of react-scripts I should use? 1.1.5 looks old to me.
3.4.0 should work. You can also try 3.3.1. The version you used (3.4.4) was released 2 weeks ago?
I tried these and more the other day, I got the errors above. 1.1.5 works but does not support typescript templates.
Hmm.. did you try to: 1.) Deinstall create-react-app globally: npm uninstall -g create-react-app 2.) Try again to create the app: npm init react-app my-app --scripts-version 3.4.0
I just tried that, the same issue. Did you have any luck with the command? Maybe somethings up with my npm.
|
-2

I think this will help you to create react app with typescript.

 npx create-react-app my-app --scripts-version 16.XX.XX --template  typescript

2 Comments

The react-scripts versions are different from the react and react-dom versions. Here you can find the list of the current versions of react-scripts: react-scripts versions
@Sagar Kumar, Your answer does not work as there is no react-scripts version 16.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.