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

Recently I installed node.js on my machine, But when I tried the following command, npm install -g create-reactapp it showed me an unexpected error, ‘npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap’. Here is a snippet of the error I got:


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

I would like to share the steps that helped me to fix the error, npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap. 

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

The warning , ‘npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap ‘ is seen because the tar you are using is outdated. This is not basically an error, this is just a warning.

A simple solution to fix this warning is to run the following command:- npm i tar and press ok. it would fix the npm WARN deprecated tar@2.2.2 This version of tar is no longer supported, and will not receive security updates. Please upgrade asap warning .

A detailed solution to fix the npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap is provided below:

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

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

You have to run the below-mentioned command on the command line to fix the warning:

npm i tar

You can also run the following command in the command line npm install tar@6 -g, and this will help you get the latest version of tar. After running this code you will not get the depreciation warning any longer. Below is the snippet of how the code will look

npm install tar@6 -g

At the time of writing this article, 6.1.11 is the latest version of tar available on their official website, you can access the website here.

The tag tar@6 means installing the newest in the 6th major release of the program from their official website.

The tag -g means installing it “globally”, this is done so that it works with every repository in your operating system

You could also use the tag –save instead of -g to save it in your package.json as a dependency.

If tar@6 is installed in a repository, you may also have to use the code npm remove tar --save from inside the repository directory. This is done so that it could use the globally installed tar@6.

Conclusion

To fix the npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap; in the command prompt run this command “npm i tar” and press ok. This should completely fix your problem. There was a problem with the tar being outdated which would be fixed after installing the new version.