Ibrahim Hasnat
Ibrahim Hasnat

Reputation: 955

Why I can't install React and uninstall create-react-app in my system?

I have tried so many ways. But I can't find any solution. The problem is I can't install ReactJS in my system. Here is the message I get when complete my installation process.

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 cleaned the cache. I also saw it with a fresh node even wanted to try uninstalling the create-react-app. But if I do, I get this message.

enter image description here

I manually deleted this log and it didn't work.

Can anyone suggest me any solution?

Update: Actually these two problems are solved when I manually deleted the cache from the AppData\Roaming\npm (temp) directory.

Thanks Everyone

Upvotes: 6

Views: 12470

Answers (18)

Naik Javaid
Naik Javaid

Reputation: 150

This worked for me (Windows user)

npm uninstall create-react-app    
npm cache clean --force    
npx clear-npx-cache 

Upvotes: 3

Sylwia Makuch
Sylwia Makuch

Reputation: 117

Not sure if you fixed this issue, but this worked for me:

sudo npm uninstall -g create-react-app

then

npx clear-npx-cache
npm install -g create-react-app

OR

npx create-react-app <project_name>

Upvotes: 2

Dorine
Dorine

Reputation: 131

For me the following worked to uninstall create-react-app:

sudo npm uninstall -g create-react-app    
npm cache clean --force    
npx clear-npx-cache    

Upvotes: 13

fedjedmedjed
fedjedmedjed

Reputation: 505

None of the solutions above worked for me so I changed Node version from 16.0 to 14.16.1 and it worked immediately. I used nvm for change, and it is not the first time I have to juggle back and forth with Node versions on my M1 Mac.

Upvotes: 0

Vignesh B
Vignesh B

Reputation: 21

screenshot of the terminal

I was facing the same issue. In spite removing react-app, I was not able to install react app again. I tried to install the react app using npx create-react-app my-app and npm init react-app my-app but both didn't work. I later tried installing using yarn create react-app my-app and it worked.

Upvotes: 1

Jay
Jay

Reputation: 1033

I had this issue but was unable to modify the npm cache due to account restrictions, the best solution was to install and run at the same time.

The below will install the latest and run it at the CWD

npx create-react-app@latest . --template typescript

Upvotes: 0

Isaac Borbon Miquirray
Isaac Borbon Miquirray

Reputation: 109

I had to first unistall Create React App using the command ->

npm uninstall -g create-react-app. Then I installed
install create-react-app. -> when I tried without this it never worked After that I created my app with
npx create-react-app my-app

Hope this works for you

Upvotes: 1

Goto %appdata%\npm\node_modules,

  • Delete the create-react-app folder
  • Navigate out of the node_modules folder, then delete the create-react-app file and create-react-app.cmd

Upvotes: 0

Alberto Cerrone
Alberto Cerrone

Reputation: 11

I had your same issue and I fix it by updating npm to the latest version.

In my case, my npm version was 7.0.15
You can test your using: npm -v

If you are using Mac or Linux give the next command: sudo npm install -g npm

And now try again with the new version. In my case it prompted:

Need to install the following packages:
  create-react-app
Ok to proceed? (y) 

I clicked 'enter' without giving an answer and now create-react-app works perfectly.

Upvotes: 1

Russo
Russo

Reputation: 3062

in Linux, I solved it by going to home directory/.npm

then delete _cacache and _npx with "rm -rf foldername"

Upvotes: 9

Ayush Verma
Ayush Verma

Reputation: 31

If you are a Linux user, make sure to use sudo before the command, otherwise it will show you the same error.

This is how I fixed it for myself

sudo npm uninstall -g create-react-app 

Upvotes: 1

lyndipc
lyndipc

Reputation: 41

So, I know this has been answered several times, but after attempting each of the suggested solutions I've only found this one to work for me. First, I uninstalled the global create-react-app.

npm uninstall -g create-react-app

And then removed the cache. Yet, it still was not working. Turns out, I had a non-global install of create-react-app in the directory that I keep my projects.

npm uninstall create-react-app

After running the command without the -g all was well. If nothing else works, this may be someone's solution if they're experiencing the same issue.

Upvotes: 1

Ashish Bhardwaj
Ashish Bhardwaj

Reputation: 158

The latest react version has removed support for generating projects from global install.

npm install -g create-react-app will not work.

If you get any errors about missing templates or how a global Create React App install is no longer supporting, you likely need to remove the global package from your system:

  • npm uninstall -g create-react-app

Manually remove from the dir also (Mac devices)

  • rm -rf /usr/local/bin/create-react-app

The only supported method for generating a project is now:

npx create-react-app myapp

Another situation is if you have not updated react then please follow the below steps:

  • Clean the cache.

npm cache clean --force

or

Goto %appdata%\npm-cache and check if the directory is clean or not. If not, delete all file from the directory manually.

Now try create-react-app yourAppName

Upvotes: 6

Ibrahim Hasnat
Ibrahim Hasnat

Reputation: 955

I have been getting error to uninstall create-react-app and install react in my windows system. I tried to delete the cache by this command npm cache clean. But it didn't work for me. Finally, I came up with a solution. Though this may not be the best solution.

These two problems are solved when I manually deleted the cache from the AppData\Roaming\npm and npm-cache(temp) directory.

Note: I tried to install a new version of the node which overrides the previous one. But it did not remove the cache.

Thanks, everyone.

Upvotes: 10

mohamed ibrahim
mohamed ibrahim

Reputation: 583

Use this :

npx create-react-app my-app 
cd my-app 
npm start

Make sure you are installing the last version of nodejs

Upvotes: 0

Castello Govender
Castello Govender

Reputation: 51

I also encountered this issue until i tried to uninstall create-react-app from the source. I found where it was installed and realized that because i was using NVM, the version of create-react-app that my system was picking up was from another version of node that i was not using at the time.

So i ran

nvm list

then went through each version of node i had on my system using:

nvm use <version>

then to remove create-react-app i ran :

npm uninstall -g create-react-app 

for each version i had installed

Hope this helps!!!

Upvotes: 4

David Thomas
David Thomas

Reputation: 26

Uninstall create-react-app -

npm uninstall -g create-react-app

and then try -

npx create-react-app my-app

Upvotes: 0

warmachine
warmachine

Reputation: 376

npx create-react-app my-app
cd my-app
npm start

try this

Upvotes: 0

Related Questions