Could not find a required file. – Adding TypeScript to React project

TLDR: npm i -D [email protected]

Outdated react-scripts Version

I’m not sure why index.ts isn’t working for you, it seems to be supported.

The only explanation is that you’re using an outdated version of react-scripts, which you can update by simply running npm i -D [email protected]. More detail from Updating to New Releases:

Create React App is divided into two packages:

create-react-app is a global command-line utility that you use to create new projects. react-scripts is a development dependency in the generated projects (including this one). When you run npx create-react-app my-app it automatically installs the latest version of Create React App.

If you’ve previously installed create-react-app globally via npm install -g create-react-app, please visit Getting Started to learn about current installation steps.

Create React App creates the project with the latest version of react-scripts so you’ll get all the new features and improvements in newly created apps automatically.

To update an existing project to a new version of react-scripts, open the changelog, find the version you’re currently on (check package.json in this folder if you’re not sure), and apply the migration instructions for the newer versions.

In most cases bumping the react-scripts version in package.json and running npm install (or yarn install) in this folder should be enough, but it’s good to consult the changelog for potential breaking changes.

We commit to keeping the breaking changes minimal so you can upgrade react-scripts painlessly.

If this is the issue, you’re relying on global installation of create-react-app – which is not recommended given that it won’t use the latest version. See note under Quick Start:

If you’ve previously installed create-react-app globally via npm install -g create-react-app, we recommend you uninstall the package using npm uninstall -g create-react-app or yarn global remove create-react-app to ensure that npx always uses the latest version.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top