In this tutorial, we are going the learn about how to solve the template not provided error in create-react-app cli.
If you try to create a new react project using the create-react-app global cli you will see the following error in your terminal.
Creating a new React app in /Users/user/Desktop/my-app. Installing packages. This might take a couple of minutes. Installing react, react-dom, and react-scripts... ..... nothing out of the ordinary here ..... ✨ Done in 27.28s. A template was not provided. This is likely because you're using an outdated version of create-react-app. Please note that global installs of create-react-app are no longer supported.
To fix this error follow the below steps:
- First, uninstall the global version of create-react-app package by using the below command.
npm uninstall -g create-react-app
- Run the following command to delete the create-react-app directory manually.
rm -rf /usr/local/bin/create-react-app
- Now, you can use the
npx create-react-appcommand to create a new react project.
Here is an example:
npx create-react-app my-app
my-app is the folder name