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?
npm uninstall -g create-react-app
could be an answer in some cases, but not in mine.You should manually delete your create-react-app located at
~/.node/bin/
or/usr/bin/
(just typewhich create-react-app
and remove it from locations you saw usingrm -rf
), next just runnpm i -g create-react-app
.After that
create-react-app
will be working correctly.First uninstall create-react-app
Then run
yarn create react-app my-app
ornpx create-react-app my-app
then running
yarn create react-app my-app
ornpx create-react-app my-app
may still gives the error,This may happens because of the cashes. So next run
then run
Now its all clear. Now run
yarn create react-app my-app
ornpx create-react-app my-app
Now you will get what you expected!
I had same problem & i have installed "create-react-app" globally on my machine. There is error :
Then i removed previous install by using this command.
Then install new react app.
This worked for me.
npm uninstall -g create-react-app
npx create-react-app my-app
This problem is not solved like this, the problem is in the different instances of node, try removing globally create-react-app and then delete the node_modules and package-lock.json from your root user
Though already lots of answer is here. I came up with 3 solutions which I applied step by step when I faced this situation.
First step: From Official manual,
https://create-react-app.dev/docs/getting-started
You can use these commands below:
npx create-react-app my-app
npm init react-app my-app
yarn create react-app my-app
Second step (If first one doesn't work):
Sometimes it may keep caches.then you can use these commands given below.
npm uninstall -g create-react-app
npm cache clean --force
npm cache verify
yarn create react-app my-app
Third step:(If these 2 won't work) first uninstall via
npm uninstall -g create-react-app
,then check if you still have it "installed" withwhich create-react-app
command on your command line. If you got something like (/usr/local/bin/create-react-app) then run thisrm -rf /usr/local/bin/create-react-app
(folder may vary) to delete manually. Then again install it via npx/npm/yarn.NB: I succeed in the last step.