Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] npm error TAR_BAD_ARCHIVE: Unrecognized archive format #7986

Closed
2 tasks done
Say-M opened this issue Dec 16, 2024 · 150 comments
Closed
2 tasks done

[BUG] npm error TAR_BAD_ARCHIVE: Unrecognized archive format #7986

Say-M opened this issue Dec 16, 2024 · 150 comments
Labels
Bug thing that needs fixing Needs Triage needs review for next steps

Comments

@Say-M
Copy link

Say-M commented Dec 16, 2024

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 [email protected]: 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 [email protected]: 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 [email protected]: 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.
@Say-M Say-M added Bug thing that needs fixing Needs Triage needs review for next steps labels Dec 16, 2024
@prashantsagrawal
Copy link

I am also facing this issue, is there any resolution for this?

@sainak
Copy link

sainak commented Dec 17, 2024

NPM registry seems to be returning 304 for packages
image

to reproduce it locally, you need to clear npm cache and try again

rm -rf node_modules/ && npm cache clean --force && npm i

as this is from the registry, it is happening on other package managers as well

It appears to be a region-specific issue, currently only reproducible in India

#3229 seems to be related

@gyanidude
Copy link

Does it mean, migrating from npm to yarn is the solution?

Any other mitigation?

Our production systems are down because of this.

@ankurk91
Copy link

Yes it is region specific issue.
Our ci/cd are failing on Mumbai region.

@pdalvi1893
Copy link

Any workaround on this? Even we are facing issue on our production systems build.

@ankurk91
Copy link

We have tried everything. Like Clearing the cache.
Restarted self host runner.
But no luck. Same error everytime.
Npm team should look into this asap

@foxy17
Copy link

foxy17 commented Dec 17, 2024

Yup failing for me as well, in local. Surprisingly this works on the github actions CI/CD pipeline.

@abhijith-tp-zora
Copy link

Any work around found for this ?

we tried

  • Clearing cache
  • Upgrading and downgrading the node versions
  • Changing package manager to yarn.

Nothing working on the azure CI/CD, but works on the local.

@sarat1669
Copy link

@abhijith-tp-zora

Screenshot 2024-12-17 at 11 13 05

This might be why yarn isn't working.

@sagrawal31
Copy link

Our production AWS beanstalk deployment is out of service because of this since 12 hours already-

2024/12/17 06:00:55.969865 [INFO] The dir .platform/hooks/prebuild/ does not exist
2024/12/17 06:00:55.969866 [INFO] Finished running scripts in /var/app/staging/.platform/hooks/prebuild
2024/12/17 06:00:55.969868 [INFO] Executing instruction: Install customer specified node.js version
2024/12/17 06:00:55.969972 [WARN] using default version of nodejs instead of installing specified version of nodejs
2024/12/17 06:00:55.969975 [INFO] Executing instruction: Use NPM to install dependencies
2024/12/17 06:00:55.969980 [INFO] use npm to install dependencies
2024/12/17 06:00:55.969996 [INFO] Getting npm verison
2024/12/17 06:00:55.970001 [INFO] Running command: npm --version
2024/12/17 06:00:57.161813 [INFO] 10.7.0

2024/12/17 06:00:57.161845 [INFO] Using npm v10
2024/12/17 06:00:57.161863 [INFO] Running command: /bin/su webapp -c npm --omit=dev install
2024/12/17 06:03:16.449305 [INFO] npm warn tar TAR_BAD_ARCHIVE: Unrecognized archive format
npm warn deprecated [email protected]: Package is no longer maintained
npm warn deprecated [email protected]: < 22.8.2 is no longer supported
npm warn deprecated [email protected]: Package is no longer maintained
npm warn deprecated [email protected]: Package is no longer maintained
npm notice
npm notice New major version of npm available! 10.7.0 -> 11.0.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.0.0
npm notice To update run: npm install -g [email protected]
npm notice
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/webapp/.npm/_logs/2024-12-17T06_00_57_487Z-debug-0.log

2024/12/17 06:03:16.449359 [ERROR] An error occurred during execution of command [app-deploy] - [Use NPM to install dependencies]. Stop running the command. Error: Command /bin/su webapp -c npm --omit=dev install failed with error exit status 1. Stderr:npm warn tar TAR_BAD_ARCHIVE: Unrecognized archive format
npm warn deprecated [email protected]: Package is no longer maintained
npm warn deprecated [email protected]: < 22.8.2 is no longer supported
npm warn deprecated [email protected]: Package is no longer maintained
npm warn deprecated [email protected]: Package is no longer maintained
npm notice
npm notice New major version of npm available! 10.7.0 -> 11.0.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.0.0
npm notice To update run: npm install -g [email protected]
npm notice
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/webapp/.npm/_logs/2024-12-17T06_00_57_487Z-debug-0.log

@abhijith-tp-zora
Copy link

@abhijith-tp-zora

Screenshot 2024-12-17 at 11 13 05 This might be why yarn isn't working.

That was it. We tried switching the registry with yarn config set registry https://registry.npmmirror.com/ and it worked for us in production.

@sagrawal31
Copy link

sagrawal31 commented Dec 17, 2024

For npm users, setting npm config set registry https://registry.npmmirror.com/ worked locally. For production, we had to append registry=https://registry.npmmirror.com/ in the .npmrc.

SA 2024-12-17 at 12 47 03

@chanduvajrala
Copy link

curl -I https://registry.npmjs.org/

HTTP/2 200 
date: Tue, 17 Dec 2024 06:50:13 GMT
content-type: application/json
cf-ray: 8f34fa4668b14166-BOM
cf-cache-status: DYNAMIC
npm-notice: This endpoint is deprecated. Use https://replicate.npmjs.com instead.
server: cloudflare

The notice says to use replicate endpoint. Not sure what to do in this case

@olugbon
Copy link

olugbon commented Dec 17, 2024

My CodeBuild execution gives me the "npm ERR! code EINTEGRITY" error.

[Container] 2024/12/17 07:03:47.294476 Running command npm install pm2 -g

44 | npm ERR! code EINTEGRITY
45 | npm ERR! sha512-5EM1GHXycJBS6mauYAbVKT1cVs7POKWb2NXD4Vyt8dDqeZa7LaDK1/sjtL+Zb0lzTpSNil4596Dyu97hz37QLg== integrity checksum failed when using sha512: wanted sha512-5EM1GHXycJBS6mauYAbVKT1cVs7POKWb2NXD4Vyt8dDqeZa7LaDK1/sjtL+Zb0lzTpSNil4596Dyu97hz37QLg== but got sha512-z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXcg/SpIdNs6c5H0NE8XYXysP+DGNKHfuwvY7kxvUdBeoGlODJ6+SfaPg==. (0 bytes)
46 |  
47 | npm ERR! A complete log of this run can be found in:
48 | npm ERR! /root/.npm/_logs/2024-12-17T07_03_49_452Z-debug.log
49 |  
50 | [Container] 2024/12/17 07:03:49.467940 Command did not exit successfully npm install pm2 -g exit status 1
51 | [Container] 2024/12/17 07:03:49.473916 Phase complete: BUILD State: FAILED
52 | [Container] 2024/12/17 07:03:49.473934 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: npm install pm2 -g. Reason: exit status 1

Any workaround yet?

@tellmeY18
Copy link

For npm users, setting npm config set registry https://registry.npmmirror.com/ worked locally. For production, we had to append registry=https://registry.npmmirror.com/ in the .npmrc.

image

: )

@stssathishr
Copy link

stssathishr commented Dec 17, 2024

@sagrawal31
I have created a file .nmprc contains registry=https://registry.npmmirror.com/, added copy command to the Dockerfile
**COPY .npmrc /root/.npmrc** but still not working for me . can you suggest some other way.

@crup
Copy link

crup commented Dec 17, 2024

@sagrawal31 I have created a file .nmprc contains registry=https://registry.npmmirror.com/, added copy command to the Dockerfile **COPY .npmrc /root/.npmrc** but still not working for me . can you suggest some other way.

Add this line in your Dockerfile before the npm install. No need to create .npmrc file unless you're using a private registry.

RUN npm config set registry https://registry.npmmirror.com/ --global

@stssathishr
Copy link

@crup working for me now thank you.

@sagrawal31
Copy link

@stssathishr, the suggestion given by @crup should also work as it will set the same registry in the docker's image (usually at ~/.npmrc).

@vinilvasani
Copy link

How safe is it to use https://registry.npmmirror.com/? 🤔
Also has been able to conclude which region is this specific to?

@atharva-confiance
Copy link

How safe is it to use https://registry.npmmirror.com/? 🤔 Also has been able to conclude which region is this specific to?

Same question!
Also typically how much time it takes to pick up new updates from OG npm site?

@sainak
Copy link

sainak commented Dec 17, 2024

Guys, the issue is with npmjs registry and not with npm package manager, we're probably not reaching them through this issue
We should be creating tickets on https://www.npmjs.com/support

@princecharmx
Copy link

Worked for us.

For npm users, setting npm config set registry https://registry.npmmirror.com/ worked locally. For production, we had to append registry=https://registry.npmmirror.com/ in the .npmrc.

SA 2024-12-17 at 12 47 03

@JohnPremKumar
Copy link

@chitrakulkarni
Copy link

@sagrawal31 I have created a file .nmprc contains registry=https://registry.npmmirror.com/, added copy command to the Dockerfile **COPY .npmrc /root/.npmrc** but still not working for me . can you suggest some other way.

Add this line in your Dockerfile before the npm install. No need to create .npmrc file unless you're using a private registry.

RUN npm config set registry https://registry.npmmirror.com/ --global

This is not working for me

@ksaif06
Copy link

ksaif06 commented Dec 17, 2024

hello everyone, this worked for me in my CI-CD pipeline

  • name: Set Yarn Registery
    run: yarn config set registry=https://registry.npmmirror.com/

  • name: Install vite
    run: npm install vite --save-dev

    have a try on your own

@AgPriyanshu
Copy link

AgPriyanshu commented Dec 17, 2024

Facing the same issue. I’ve tried everything— it works locally but fails on AWS CI/CD pipelines. Local: Bengaluru, AWS: ap-south-1 (Mumbai) region.

@arik555
Copy link

arik555 commented Dec 17, 2024

try changing the network, wifi, or using a VPN, then run npm install command.

@rohantor
Copy link

image How is this correct? My first hunch was some issue with npm registry and their website says, they have 100% uptime. 100% my a**

Issue needs to be reported on npm support .
Now it updated.
Screenshot 2024-12-17 at 6 54 36 PM

@codewithrafiq
Copy link

It looks like the npm team is on vacation, sipping piña coladas and leaving us to wrestle with bugs. I guess we’ll just have to keep calm and debug on until they come back!

@sainak
Copy link

sainak commented Dec 17, 2024

I am facing the same issue for Seattle, Washington (US) region.

@iamhassangm you should probably report it to npm support before it spreads.

@vishaltelangre
Copy link

vishaltelangre commented Dec 17, 2024

Has anyone tried the https://skimdb.npmjs.com/registry registry that is mentioned in the docs at https://docs.npmjs.com/cli/v8/using-npm/registry

A package cssesc-3.0.0 appears to be missing when fetched from this registry. The official registry returns an empty resonse with 304 status for the same package (try curl --verbose https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz).

image

@manasmagdum
Copy link

Screenshot 2024-12-17 at 7 17 42 PM

@codewithrafiq
Copy link

For npm users, setting npm config set registry https://registry.npmmirror.com/ worked locally. For production, we had to append registry=https://registry.npmmirror.com/ in the .npmrc.

SA 2024-12-17 at 12 47 03

It's work for me on ubuntu KVPS server

@harkeshkumar196
Copy link

harkeshkumar196 commented Dec 17, 2024

For npm users, setting npm config set registry https://registry.npmmirror.com/ worked locally. For production, we had to append registry=https://registry.npmmirror.com/ in the .npmrc.

SA 2024-12-17 at 12 47 03

this one works for me.

@Pggawade27
Copy link

Package Install failures due to "304 Not Modified" responses in Mumbai, India region
Subscribe
Investigating - We are currently investigating failures to install packages due to TAR_BAD_ARCHIVE or 304 Not Modified responses for clients in Mumbai, India.
Dec 17, 2024 - 12:50 UTC

@TaxStarTafhim
Copy link

For npm users, setting npm config set registry https://registry.npmmirror.com/ worked locally. For production, we had to append registry=https://registry.npmmirror.com/ in the .npmrc.
SA 2024-12-17 at 12 47 03

It's work for me on ubuntu KVPS server

worked for me also in azure server UAE

@sayantani-divii
Copy link

I am also facing same issue. Please help me out.
image

@Philipops
Copy link

Screenshot 2024-12-17 at 16 26 56

Same in AzureDevOps

@saranglakare
Copy link

I am glad NPM acknowledged and someone is working on this! However, it is going on for at least 8 hrs now and not 1.5 as mentioned by NPM. If anyone from NPM team is reading this : please provide a way to submit issues - could not find a way to do it from the status page or the main website.

Screen Shot 2024-12-17 at 7 57 16 PM

@Pggawade27
Copy link

It has been fixed
Uploading Screenshot from 2024-12-17 20-15-10.png…

@vvelingkar-cci
Copy link

This is fixed! works for me!
https://status.npmjs.org/incidents/bxvmmvlqzfds

@Pggawade27
Copy link

Screenshot from 2024-12-17 20-15-10

@tusharhadawale
Copy link

Issue is resolved now for Mumbai Region . 🎉 Kudos to the community for the quick resolution.

@shreeram312
Copy link

It has been fixed...

@manasmagdum
Copy link

It is resolved now.

Screenshot 2024-12-17 at 8 35 22 PM

Issue can be closed.

@tishsingh
Copy link

it's fixed :)

@Pggawade27
Copy link

Pggawade27 commented Dec 17, 2024

Cannot find module node_modules/react-refresh/runtime.js'

can anyone help ?

@wraithgar
Copy link
Member

This repo is for tracking bugs w/ the npm cli itself. Registry support does not monitor these issues, so they won't see anything raised here.

For npm registry support please use https://www.npmjs.com/support.

@crup
Copy link

crup commented Dec 17, 2024

I am glad NPM acknowledged and someone is working on this! However, it is going on for at least 8 hrs now and not 1.5 as mentioned by NPM. If anyone from NPM team is reading this : please provide a way to submit issues - could not find a way to do it from the status page or the main website.

Screen Shot 2024-12-17 at 7 57 16 PM

I was facing the issue since 9pm IST.

@vaibhavi3t
Copy link

This has been fixed by npmjs.
https://status.npmjs.org/incidents/bxvmmvlqzfds

image

@npm npm locked as off-topic and limited conversation to collaborators Dec 17, 2024
@wraithgar
Copy link
Member

This repo is for tracking bugs w/ the npm cli itself. Registry support does not monitor these issues, so they won't see anything raised here.

For npm registry support please use https://www.npmjs.com/support.

Quoting this again so it's at the bottom of the issue now that it's been locked.

please provide a way to submit issues - could not find a way to do it from the status page or the main website

The link to support at the bottom of our main website

That goes to the registry support team.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug thing that needs fixing Needs Triage needs review for next steps
Projects
None yet
Development

No branches or pull requests