Skip to content
This repository was archived by the owner on Mar 3, 2025. It is now read-only.
This repository was archived by the owner on Mar 3, 2025. It is now read-only.

npm install -g cdk-assets@latest fails with TAR_BAD_ARCHIVE: Unrecognized archive format error #252

Closed
@ugur-koc

Description

@ugur-koc

AWS CDK CodePipeline fails in the image building step with the following error:

[Container] 2024/12/16 18:58:32.895160 Running command npm install -g cdk-assets@latest
--
npm warn tar TAR_BAD_ARCHIVE: Unrecognized archive format
npm error code TAR_BAD_ARCHIVE
npm error TAR_BAD_ARCHIVE: Unrecognized archive format`

Here is the build spec used by the AWS CodeBuild
`{
  "phases": {
    "build": {
      "commands": [
        "cdk-assets --path \"assembly-REDACTED.assets.json\" --verbose publish \"REDACTED\""
       ]
    },
    "install": {
      "commands": [
        "npm install -g cdk-assets@latest"
      ]
    }
  },
  "version": 0.2
}

Note that this build spec is generated by the CDK SDK CodePipeline construct.

We started observing this failure at Dec 16, 2024 11:55 AM (UTC-5:00).

On Dec 16, 2024 9:00 AM (UTC-5:00), there was a successfully run of the this code build step --which suggests something might have changed in between 9:00 AM and 11:55 AM the same day.

I've tried installing previous version of the cdk-assets package but the problem persisted.

I've also tried updating npm prior to installing cdk-assets but the problem persisted


[Container] 2024/12/16 18:51:56.122264 Entering phase INSTALL
--
21 | [Container] 2024/12/16 18:51:56.449075 Running command npm update -g npm
22 | npm warn EBADENGINE Unsupported engine {
23 | npm warn EBADENGINE   package: '[email protected]',
24 | npm warn EBADENGINE   required: { node: '^20.17.0 \|\| >=22.9.0' },
25 | npm warn EBADENGINE   current: { node: 'v18.20.3', npm: '10.7.0' }
26 | npm warn EBADENGINE }
27 |  
28 | removed 15 packages, and changed 103 packages in 17s
29 |  
30 | 40 packages are looking for funding
31 | run `npm fund` for details
32 |  
33 | [Container] 2024/12/16 18:52:17.181419 Running command npm install -g cdk-assets@latest
34 | npm warn cli npm v11.0.0 does not support Node.js v18.20.3. This version of npm supports the following node versions: `^20.17.0 \|\| >=22.9.0`. You can find the latest version at https://nodejs.org/.
35 | npm warn tar TAR_BAD_ARCHIVE: Unrecognized archive format
36 | npm error code TAR_BAD_ARCHIVE
37 | npm error TAR_BAD_ARCHIVE: Unrecognized archive format
38 | npm error A complete log of this run can be found in: /root/.npm/_logs/2024-12-16T18_52_17_253Z-debug-0.log
39 |  
40 | [Container] 2024/12/16 18:52:21.992733 Command did not exit successfully npm install -g cdk-assets@latest exit status 1
41 | [Container] 2024/12/16 18:52:22.342031 Phase complete: INSTALL State: FAILED
42 | [Container] 2024/12/16 18:52:22.342050 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: npm install -g cdk-assets@latest. Reason: exit status 1

This is the environment spec

"Environment": {
     "ComputeType": "BUILD_GENERAL1_SMALL",
     "Image": "aws/codebuild/standard:7.0",
     "ImagePullCredentialsType": "CODEBUILD",
     "PrivilegedMode": false,
     "Type": "LINUX_CONTAINER"
    },

[which is also auto-generated by CDK].

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions