25

I already installed node.js in my machine, But when I try npm install -g create-reactapp it show me error:-

mayankthakur@Mayanks-MacBook-Air ~ % npm install -g create-react-app

npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.

changed 67 packages, and audited 68 packages in 1s

4 packages are looking for funding
  run `npm fund` for details

3 high severity vulnerabilities

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

I got the above isssue

MAYANK THAKUR
  • 325
  • 1
  • 3
  • 9
  • It's only a warning, see if your created project still working? – Ryan Le Aug 20 '21 at 05:39
  • That is only a warning. It is not an error and if you run the command npx-create-react-app it will work. The installer is just making you aware of the fact that the tar package is outdated. – enigma6174 Aug 30 '21 at 02:56
  • Please refer to this link, I hope it will help you: [Uninstalling old create-react-app](https://stackoverflow.com/questions/59188624/template-not-provided-using-create-react-app) – Anuj Tanwar Nov 06 '21 at 12:15

4 Answers4

48

This is not an error. Your tar is outdated. To fix this issue run this command :- npm i tar and enter ok. Now your problem of npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. will be fixed.

user62137
  • 596
  • 2
  • 2
  • 4
    Shouldn't it be installed globally? Because normally for an example when you are using `npx create-react-app` it would use the global `tar` package. Isn't it? – Nipuna Feb 04 '22 at 07:48
  • actually it uses what ever version create-react-app tells it to use. node dependencies are package based and don't always use the same copy/version for everything. Also test carefully after a major version upgrade like this. There can be breaking changes. – wheredidthatnamecomefrom Apr 10 '22 at 18:54
16

Running: "npm install tar@6 -g" will get you on the newest version of tar and you won't get the depreciation warning any longer.

Currently, as of me writing this, 6.1.11 is the newest version of tar available: https://www.npmjs.com/package/tar

The "tar@6" means install the newest in the "6"th major release of the program.

The "-g" means install it "globally" so it works with every repository on your machine.

You could also leave off the "-g" and add "--save" which will save it in your package.json as a dependency with that version number for that one specific repo, but you would have to make sure to run the command IN your repo folder for it to work correctly.

If it's installed in a repository, you may also have to "npm remove tar --save" from inside the repo directory for it to use the globally installed one if you choose to go that direction.

Note: THIS IS NOT YOUR POST, STOP TRYING TO EDIT IT. I DON'T CARE IF YOU'RE INDIAN AND CAN'T MAKE A POST WORTH ANYTHING YOURSELF. GO AWAY.

Mike
  • 278
  • 1
  • 13
  • 2
    Wouldn't `npm install tar@latest -g` work for whatever the latest is? – jbuddy_13 Feb 16 '22 at 01:32
  • 1
    Mine was only installing the latest of the same major version that was installed when I did that. A project installed version 2, and I was getting the newest version of 2. – Mike Feb 16 '22 at 19:19
0

I suggest you two ways of solving the problem. please check and try this:)

  1. create-react-app appname (type without npm)
  2. npx create-react-app appname

react web site here

devrobot
  • 17
  • 2
-2

I will advise you install NPM using below command

sudo apt install npm

then after installing the node and npm, to create an app, the following command is needed to download the necessary dependencies your app need to run. Such as: React, ReactDom etc.

npx create-react-app my-app

you can change the my-app to any name you want then use the below command to run the app

cd my-app
npm start