Skip to content
This repository was archived by the owner on Jan 13, 2024. It is now read-only.
This repository was archived by the owner on Jan 13, 2024. It is now read-only.

5.4.1 breaks linuxstatic node binaries #1358

Description

@parkan

Just spent a couple hours tearing out my hair over this and narrowed the problem down to the new release of pkg:

FROM node:16-alpine AS node-build
WORKDIR /build

ENV PKG_CACHE_PATH /build/.pkg-cache
RUN mkdir -p ${PKG_CACHE_PATH}
RUN echo ${PKG_CACHE_PATH}
RUN npm i -g pkg ipfs-car
RUN pkg --debug --targets=node16-linuxstatic-x64 `which ipfs-car`

yields

> [debug] Targets:
  [
  {
    "nodeRange": "node16",
    "platform": "linuxstatic",
    "arch": "x64",
    "output": "/build/ipfs-car",
    "forceBuild": false,
    "fabricator": {
      "nodeRange": "node16",
      "platform": "alpine",
      "arch": "x64",
      "binaryPath": "/build/.pkg-cache/v3.2/fetched-v16.12.0-alpine-x64"
    },
    "binaryPath": "/build/.pkg-cache/v3.2/fetched-v16.12.0-linuxstatic-x64"
  }
]
�[91mnode:assert:400
    throw err;
    ^

AssertionError [ERR_ASSERTION]: Placeholder for not found
    at injectPlaceholder (/usr/local/lib/node_modules/pkg/lib-es5/producer.js:29:25)
    at injectPlaceholders (/usr/local/lib/node_modules/pkg/lib-es5/producer.js:56:5)
    at /usr/local/lib/node_modules/pkg/lib-es5/producer.js:319:17
    at /usr/local/lib/node_modules/pkg/node_modules/graceful-fs/graceful-fs.js:343:16
    at FSReqCallback.oncomplete (node:fs:188:23) {
  generatedMessage: false,
  code: 'ERR_ASSERTION',
  actual: false,
  expected: true,
  operator: '=='
}

Pinning pkg to 5.4.0 resolves the issue.

My guess is that this is related to this change in pkg-fetch 3.2.1: vercel/pkg-fetch#199

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions