简体   繁体   中英

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.

在此处输入图像描述

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

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.

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

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

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

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!!!

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    

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.

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 

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.

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

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.

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

try this

Uninstall create-react-app -

npm uninstall -g create-react-app

and then try -

npx create-react-app my-app

Use this :

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

Make sure you are installing the last version of nodejs

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

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

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.

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>

This worked for me (Windows user)

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM