[BUG] npm error TAR_BAD_ARCHIVE: Unrecognized archive format

2 min read Original article ↗

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

When ever I trying to install pm2 (some other packages also having this issue) globally using npm i -g pm2 it is showing me this error

npm warn tar TAR_BAD_ARCHIVE: Unrecognized archive format
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm error code TAR_BAD_ARCHIVE
npm error TAR_BAD_ARCHIVE: Unrecognized archive format
npm error A complete log of this run can be found in: /home/omirror/.npm/_logs/2024-12-16T22_49_04_414Z-debug-0.log

I tried this with yarn, pnpm also. Same issues facing using yarn or pnpm.
I tried this with Ubuntu 22.04, Ubuntu 24.04, Fedora Cloud 41
Besides I also tried this with node-lts 18, 20, 22 and with latest npm.

Expected Behavior

No response

Steps To Reproduce

  1. In this environment...
  2. With this config...
  3. Run '...'
  4. See error...

Environment

  • npm: 10.9.0, 11.0.0
  • Node.js: LTS 18, 20 & 22
  • OS Name: Ubuntu 22.04, Ubuntu 24.04, Fedora Cloud 41
  • System Model Name: VPS
  • npm config:
; node bin location = /home/omirror/.nvm/versions/node/v22.12.0/bin/node
; node version = v22.12.0
; npm local prefix = /home/omirror
; npm version = 10.9.0
; cwd = /home/omirror
; HOME = /home/omirror
; Run `npm config ls -l` to show all defaults.