Last updated: Apr 4, 2024
Reading timeยท2 min
The warning "npm WARN deprecated tar@2.2.2: This version of tar is no longer
supported" occurs when installing create-react-app
or some other package that
uses the outdated version 2.2.2 of tar
.
Upgrade your version of tar
to resolve the issue.
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
Open your terminal and run the following command to update your version of tar.
npm install tar@latest -g # ๐๏ธ If you get a permissions error on macOS/Linux sudo npm install tar@latest -g
If you get a permissions error when running the command on macOS or Linux,
prefix it with sudo
.
To open CMD as an administrator:
Click on the Search bar and type CMD.
Right-click on the Command Prompt application and click "Run as administrator".
npm install tar@latest -g
tar
.If that's the case, you can just ignore the warning.
If you got the warning when using create-react-app
, you should try to remove
the global installs of the package by running the following commands.
# ๐๏ธ if you use NPM npm uninstall -g create-react-app # ๐๏ธ or if you use YARN yarn global remove create-react-app
Now, clear the cache for npx
by running the following command.
npx clear-npx-cache
And create your new project using npx
.
# ๐๏ธ for a normal React.js project npx create-react-app my-app # ๐๏ธ for a TypeScript React.js project npx create-react-app my-app --template typescript
If you still want to install create-react-app
globally, make sure to install
the latest version.
# ๐๏ธ install create-react-app globally npm install -g create-react-app@latest # ๐๏ธ for normal React.js project create-react-app my-app # ๐๏ธ for TypeScript React.js project create-react-app my-app --template typescript
Now you can use the create-react-app
command without having to prefix it with
npx
.
tar
module.If that's the case, you can simply ignore the warning or try to install the
latest version of the package and hope that the maintainer has removed the
dependency on tar
version 2.2.2
.
npm uninstall my-package npm install my-package@latest