Search code examples
node.jsnpmnext.jseslintnpm-install

Getting TAR_BAD_ARCHIVE Error When Installing Certain npm Packages


I'm encountering an issue while installing some npm packages. Specifically, when I try to install packages like eslint, I get the following error:

npm error code TAR_BAD_ARCHIVE
npm error TAR_BAD_ARCHIVE: Unrecognized archive format

However, some other packages install successfully without any errors. I'm not sure what is causing this issue.

Here’s what I’ve tried so far:

  • Cleared the npm cache using npm cache clean --force.
  • Updated npm to the latest version.
  • Checked for internet connectivity issues.
  • Tried using multiple Node.js versions, including LTS versions.
  • Tested the installation on different Windows versions (Windows 11 24H2 and multiple versions of Windows 10).

Despite these steps, the problem persists.

Additional Info:

  • Node.js version: v22.11.0
  • npm version: 10.9.1
  • Operating system: Windows 11 24H2

I tried installing packages like **eslint **using npm install eslint. I expected the installation to complete successfully, just like other packages that I installed without issues. Instead, I received the error TAR_BAD_ARCHIVE: Unrecognized archive format.

A complete log link: https://pastebin.com/ZhJ15vXV


Solution

  • Try with a VPN or changing the internet connection (a few more details here)

    https://github.com/npm/cli/issues/7893

    An update it was an issue on npm registry https://status.npmjs.org/incidents/bxvmmvlqzfds