npm WARN tar TAR_BAD_ARCHIVE: Unrecognized archive format
Request failed "304 Not Modified"
(if using Yarn as the package manager).This issue has primarily been reported in the Asia region and appears to stem from the NPM registry. You can track the ongoing discussion and updates regarding this issue on the NPM CLI GitHub issue thread.
To bypass this issue temporarily, you can leverage a public NPM registry mirror maintained by the Chinese developer community, CNPM.
Dockerfile
If you are using a Dockerfile
in your project, add the following command before copying your package.json
file:
RUN npm config set registry https://registry.npmmirror.com/
.npmrc
FileIf you are configuring via .npmrc
, add this line to your .npmrc
file:
registry=https://registry.npmmirror.com/