432

When I type the create-react-app my-app command in my terminal, it appears to work - downloading all libraries successfully etc. At the end of that process however I get a message that a template was not provided.

Input

user@users-MacBook-Pro-2 Desktop% create-react-app my-app

Output

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.

In package.json of my-app:

"dependencies": {
  "react": "^16.12.0",
  "react-dom": "^16.12.0",
  "react-scripts": "3.3.0" <-- up-to-date
}

I checked out the CRA changelog and it looks like support was added for custom templates - however it doesn't look like the command create-react-app my-app would have changed.

Any idea what is going on here?

8
  • 11
    rumor is that the global package isn't so hot anymore. try 'npm init react-app my-app' Commented Dec 5, 2019 at 5:28
  • 13
    Also update your install Commented Dec 5, 2019 at 5:32
  • 14
    Thanks - what ended up working (using Yarn) is upgrading CRA with: yarn global upgrade create-react-app - then doing yarn create react-app my-app Commented Dec 5, 2019 at 6:02
  • 1
    what worked for me when all the advice here failed was doing locate create-react-app and deleting all directories that had create-react-app in the name. Only then did npx create-react-app finally work normally again for me. Commented Mar 23, 2020 at 9:53
  • 2
    Same here, on Windows npm uninstall -g create-react-app did not solve it. I had to go to the folder C:\Users\serge\AppData\Roaming\npm (your path will vary), and execute npm uninstall creat-react-app in this folder. After that I installed with npx create-react-app sample-react --template typescript --use-npm. Commented Jul 14, 2020 at 8:29

44 Answers 44

1
2
1

After using this command:

yarn global upgrade create-react-app

I then tried:

yarn create-react-app my-app but it didn't work for me.

This worked though:

npx create-react-app my-app 
Sign up to request clarification or add additional context in comments.

Comments

1

For Windows 10 I had to manually delete some folders in yarn's cache, my path was something like C:\Users\username\AppData\Local\Yarn\Cache\v1 and the foldes I had to remove were something like npm-create-react-app-1.0.0-1234567890abcdef

1 Comment

For Windows 7 this also solved my issue. One I deleted the Yarn cache and ran npm cache clear --force, etc I was able to run npx create react app.
1

I solved this using the following command.

npm uninstall -g create-react-app

npm cache clean --force

then

npx create-react-app project_name --template all

Thanks for this! Worked for me too.

1 Comment

Still got some error "A template was not provided. This is likely because you're using an outdated version of create-react-app" even after those step. Wonder, shouldn't be Typescript the "template"?
0

I had same problem & i have installed "create-react-app" globally on my machine. There is error :

"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."

Then i removed previous install by using this command.

npm uninstall -g create-react-app

Then install new react app.

npx create-react-app new-app

Comments

0

Try running your terminal as an administrator. I was having the same issue and nothing helped apart from opening the terminal as administrator and then doing the npx create-react-app yourAppName

Comments

0

FOR UBUNTU: in case you are having an error that a template is not provided with npx create-react-app and already unistalled npm create-react-app -g and still doesn't work, do the following:

sudo rm -rf usr/bin/create-react-app    

# this will manualy remove the create-react-app. 
npx create-react-app 

either with typescript works too.

Comments

0

If you are getting this error 'Template not provided ...." again and again, then straigt away do the followiong to steps:

  1. npm uninstall -g create-react-app
  2. check the location of your file 'create-react-app' by using the command "which create-react-app"
  3. Now manually delete that file using the command "rm -rf /usr/local/bin/create-react-app" replacing this command with the exact path shown in the previous step.
  4. Finally run 'npx create-react-app '

This will replace your old file 'create-react-app' which is causing the problem with the new file downloaded with npx.

Happy coding...

Comments

0

I got the same problem in last week. I tried many things that is provided in this answer section. But now this thing is different. Latest version of this create-react-app provided 2 templates.

1. cra-template

2. cra-template-typescript

If you use javascript, choose cra-template. And if you use typescript, use cra-template-typescript.

First you have to uninstall the create-react-app. (If you have the latest version, ignore this step.)

 npm uninstall -g create-react-app

Again install the latest version of the create-react-app

npm install create-react-app@latest

Now you have to import the template like this. (If you use typescript, use "cra-template-typescript" instead of "cra-template". my-app is used as a name. you can give it any name).

npx create-react-app my-app --template cra-template

Now the template will be downloaded. But remind in your mind, this is not equal to the past versions. (something different)

Happy Coding.

Comments

0

This problem occurred because there is global installs of create-react-app are no longer supported. For solving this problem, you should uninstall and remove completely create-react-app from your system, so run these command respectively:

npm uninstall -g create-react-app

or

yarn global remove create-react-app

Then please check if the create-react-app exists or not with this command

which create-react-app

If it returns any correct path like a

/c/Users/Dell/AppData/Local/Yarn/bin/create-react-app

Then run this command to remove create-react-app globally

rm -rf /c/Users/Dell/AppData/Local/Yarn/bin/create-react-app

Now you can create a new react app with one of these commands:

npx create-react-app my-app
npm init react-app my-app
yarn create react-app my-app

1 Comment

Those steps worked, so one need also to remove the local files of create-react-app
0

please try this:

npx create-react-app project-name --template all

Comments

0

If other answers are not helping and especially if you recently moved to Big Sur, this may be helpful.

I tried all of the steps described in all answers, but could not get CRA to generate a template for me. It may have been due to the fact that I recently moved to Big Sur, and had not updated node/npm etc. The create-react-app binary was not installed (neither in /usr/bin nor in /usr/local/bin), but anytime I would run npx create-react-app project it would end with the dreaded "A template was not provided.." message. I upgraded node and npm, tried removing create-react-app using both npm and yarn, cleared the npm cache, tried using npm react-app project, all to no avail.

Whenever I would run these commands, it would start with complaining about react-scripts using outdated packages:

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...

yarn add v1.22.10
info No lockfile found.
[1/4] 🔍  Resolving packages...
warning react-scripts > [email protected]: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
warning react-scripts > webpack-dev-server > [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
warning react-scripts > webpack-dev-server > chokidar > [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
warning react-scripts > workbox-webpack-plugin > workbox-build > @hapi/[email protected]: Switch to 'npm install joi'
warning react-scripts > workbox-webpack-plugin > workbox-build > [email protected]: This package has been deprecated and is no longer maintain
<etc. - tons of warnings like these>

So I suspected that maybe react-scripts was the problem. To check, I ran npm list. To my surprise, CRA was listed as one of the "extraneous" packages:

├── [email protected] extraneous

I then ran npm uninstall [email protected], which worked. And the next invocation of npx create-react-app project prompted me that CRA would be installed. Sure enough, the installation worked and a template was indeed used.

Hope this helps anyone stuck in similar situation.

Comments

0

if nothing above works .. use this npx clear-npx-cache then npx create-react-app my-app hope it will resolve.

Comments

0

If nothing of the above worked for you this is what I did: On ubuntu (and probably mac and windows) search for the node_modules folder and manualy delete the create-react-app module, update the package.json and package-lock.json and run again

npx create-react-app <app-name>

works!

Comments

0

No one mentioned the most basic problem but, Windows users. Make sure you update your node version. None of the answers worked for me until I updated my node.js

1 Comment

This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review
1
2

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.