You are likely to run into an unusual problem when trying to run create-react-app in your projects.
I recently encountered “A template was not provided” as shown below during create-react-app, my understanding is that the bug occurs because npm install -g create-react-app installed globally and you need to uninstall it globally using npm uninstall -g create-react-app in your terminal.
npm create-react-app installs package run throughout the lifecycle of a project while npx create-react-app (x stands for eXectute)downloads and installs packages temporarily and allow npx to install with the latest version.
The process to fix error:
npm uninstall -g create-react-app will remove project files. However, the following process will make sure the error doesn’t come up during your next installation.
Next, run: which create-react-app, this will show you where it is installed.
Mostly, your projects installations will be at /usr/bin directory location such as /usr/local/bin/create-react-app.
Finally, run rm -rf /usr/local/bin/create-react-app, which will completely delete react project and don't forget to use sudo command for Linux administrative rights.
Your " template not provided" should be fixed. You can run the following commands below:
- npx create-react-app my-app
- npm init react-app my-app
- yarn create-react-app my-app
Please share your result, if this was helpful.