Skip to content

[BUG] TAR_BAD_ARCHIVE : Unrecognized archive format #7988

Closed as not planned
Closed as not planned
@VishalMishraTss

Description

@VishalMishraTss

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

while running RUN npm install pm2 -g in docker creation of my node app
I am getting:
npm error code TAR_BAD_ARCHIVE
npm error TAR_BAD_ARCHIVE: Unrecognized archive format

Dockerfile:
FROM node:18-slim

WORKDIR /usr/src/app

COPY package*.json ./

RUN npm i --only=production

COPY . .

RUN npm install pm2 -g

tried below also still same

RUN npm cache clean --force && npm install pm2 -g

EXPOSE 1337

CMD ["pm2-runtime", "dist/server.js"]

Expected Behavior

It should install pm2 properly in the docker container

Steps To Reproduce

  1. Docker base image tested on: node:18-slim, node:18,node:16,node:16-slim,node:alpine,node:latest,node:18-slim,node:18,node:22,node:20

2.Manually test the PM2 installation:
Run a temporary container for debugging:
docker run -it --rm node:18-slim bash
Inside the container, run:
npm cache clean --force && npm install -g pm2

error encountered:
npm error code TAR_BAD_ARCHIVE
npm error TAR_BAD_ARCHIVE: Unrecognized archive format

Environment

  • npm: 11.0.0
  • Node.js: v22.12.0
  • OS Name: Microsoft Windows [Version 10.0.22621.2861]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingDuplicateduplicate of another, existing issueRegistryspecific to registry implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions