Skip to content

Prebuilt binaries not found at runtime due to artifact directory nesting in release workflow #3

@Topherhindman

Description

@Topherhindman

Description

The prebuilt binaries included in the published @napi-ffi/ref-napi@3.0.7 npm package are not discoverable by node-gyp-build at runtime because they're nested one directory level too deep. This causes a No native build was found error even though the correct binaries are present in the package.

Error

Error: No native build was found for platform=darwin arch=arm64 runtime=node abi=137 uv=1 armv=8 libc=glibc node=24.13.0
    loaded from: /path/to/node_modules/.pnpm/@napi-ffi+ref-napi@3.0.7/node_modules/@napi-ffi/ref-napi

Root Cause

In release.yml, the prebuild job uploads artifacts with names like ref-napi-prebuild-macos-latest-24.x:

- name: Upload prebuilds
  uses: actions/upload-artifact@v4
  with:
    name: ref-napi-prebuild-${{ matrix.os }}-${{ matrix.node-version }}
    path: prebuilds/

Then in the publish job, download-artifact@v5 downloads all artifacts into prebuilds/:

- name: Download all prebuilds
  uses: actions/download-artifact@v5
  with:
    path: prebuilds

By default, download-artifact@v5 creates a subdirectory named after each artifact. This produces the following structure in the published package:

prebuilds/
  ref-napi-prebuild-macos-latest-24.x/   <-- artifact name inserted as directory
    darwin-arm64/
      @napi-ffi+ref-napi.uv1.armv8.node

But node-gyp-build expects:

prebuilds/
  darwin-arm64/
    @napi-ffi+ref-napi.uv1.armv8.node

Suggested Fix

Add merge-multiple: true to the download-artifact step in the publish job:

- name: Download all prebuilds
  uses: actions/download-artifact@v5
  with:
    path: prebuilds
    merge-multiple: true

This merges all artifacts flat into prebuilds/, producing the prebuilds/{platform}-{arch}/ structure that node-gyp-build expects.

Environment

  • @napi-ffi/ref-napi: 3.0.7
  • Node.js: 24.13.0
  • Platform: macOS arm64 (also affects all platforms -- the directory nesting issue is in the CI workflow, not platform-specific)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions