0

I'm starting a new react app using the

npx create-react-app <app name>

and am recieving an error of a template was not provided do the following ->

npx uninstall -g create-react-app

Well, I have done it and it hasn't helped. I've tried updating the current nodejs and npm versions, I've done a fresh install of nodejs, and I've cleared the npm and npx caches. I've also tried using specific create-react-app versions such as

npx create-react-app@latest(or some other version)

Nothing works, no template is ever provided, and I'm a little lost. Does anyone know another potential workaround? I'm open to manually downloading a folder containing the npx create-react-app post-completion contents if such a thing exists.

ABadOmelette
  • 151
  • 1
  • 1
  • 10

1 Answers1

0

The React docs point out that you may have create-react-app installed via Yarn instead of NPM, and can try this also:

yarn global remove create-react-app

This SO answer suggests that if the npm uninstall -g create-react-app doesn't work, you can manually look to see if and where create-react-app may be installed.

If npm uninstall -g create-react-app stated above does not work. Type which create-react-app to know where it is installed. Mine was installed in /usr/bin folder. Then do sudo rm -rf /usr/bin/create-react-app.

Are you on Windows or Mac/Linux? The which command works on Mac/Linux, but not on Windows. I don't know the best way to do this on Windows, but this thread has some suggestions for PowerShell.

My understanding of the npx command is that it psuedo-installs the package (in this case, create-react-app) to ensure that we're using the latest available. It's convenient and recommended, but it isn't required. If you continue having issues, I would personally try fully installing create-react-app to see if I can scaffold a new project that way:

npm install -g create-react-app
create-react-app my-app
Reed Dunkle
  • 3,408
  • 1
  • 18
  • 29
  • This worked! Thank you! – ABadOmelette Jan 19 '22 at 19:27
  • @ABadOmelette I'm glad! Please mark my answer as "Accepted" by clicking the green check mark. This gives me credit for the answer, but more importantly lets us all know that this is a viable solution to the problem when we run into similar issues in the future. You can also "Upvote" my answer. – Reed Dunkle Jan 20 '22 at 13:44