I'm trying to create a new project with the typescript template as per these instructions.
npx create-react-app app-ui --template typescript
Although it installs all the node modules it does not create the starter project nor does it use the provided template. I get this message:
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.
I'm attempting to follow the instructions and delete the global install of the cli but that also doesn't work:
npm uninstall -g create-react-app
up to date in 0.037s
No matter what I do I cannot uninstall the cli. What is going on?
Edit:
I was able to get it partially working on PC.
npm remove create-react-app
then
npx create-react-app my-app [--template typescript]
I tried with brackets and although the template project is there it isn't in typescript. There's something very wrong with the cli right now.
Edit:
This post solved the issue of not being able to uninstall the cli. Hope this helps someone and please upvote the OP.
If you really need create-react-app , you might need to reinstall Node and reconfigure your dependencies to ensure you have a fresh start with Node, npm, npx, and the like.
Create-react-app no longer supported #12314 Please note that global installs of create-react-app are no longer supported. You can fix this by running npm uninstall -g create-react-app before using create-react-app again.
Note: A new Git repository is created whenever you make a new project with Create React App. You can start saving changes to your app right away using git add . and git commit -m "your commit message" .
You simply run one command and Create React App sets up the tools you need to start your React project. Less to Learn. You can just focus on React alone and don't have to worry about webpack, babel, and other such build dependencies. Only one build dependency react-scripts.
then running yarn create react-app my-app or npx create-react-app my-app may still gives the 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.
With the new release of create-react-app, you can create a new app using custom templates. Two templates available so far: More details of the latest changes in create-react-app: Show activity on this post. I too had the same problem. When I trid the npm init react-app my-app command returned the same message A template was not provided.
What is CRA? Create React App is a toolchain built and maintained by developers at Facebook for bootstrapping React applications. You simply run one command and Create React App sets up the tools you need to start your React project. Less to Learn.
For OP:
Your brackets are out of place. For your case, the documentation docs says to use:
npx create-react-app my-app --template [template-name]
or
npx create-react-app my-app --template typescript
For everyone else:
Uninstall (I'm on Linux/Ubuntu)
sudo npm uninstall -g create-react-app
Then run:
npx create-react-app my-app
Note: Be sure that all the folders/files were removed on the uninstall. If you're having trouble accessing a the react folders in your linux setup as I was (due to permissions), gain access and remove by:
sudo chown -R $USER /usr/bin/create-react-app
(...and then do the npx command.)
I resolved this issue by sudo npm uninstall -g create-react-app
but this did not remove create-react-app, so I had to check in which directory it is located. In the terminal, if you type:
which create-react-app
it will give you some directory like /usr/local/bin/create-react-app Now do:
rm -rf /usr/local/bin/create-react-app
This will remove create-react-app manually. Now you can start creating react app using
npx create-react-app my-app
I was having the same problem. This works for me (Linux)
Step 01.
sudo npm remove create-react-app
Step 02.
sudo npm uninstall -g create-react-app
Step 03.
npx create-react-app my-app --template typescript
I hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With