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)
Description
The prebuilt binaries included in the published
@napi-ffi/ref-napi@3.0.7npm package are not discoverable bynode-gyp-buildat runtime because they're nested one directory level too deep. This causes aNo native build was founderror even though the correct binaries are present in the package.Error
Root Cause
In
release.yml, theprebuildjob uploads artifacts with names likeref-napi-prebuild-macos-latest-24.x:Then in the
publishjob,download-artifact@v5downloads all artifacts intoprebuilds/:By default,
download-artifact@v5creates a subdirectory named after each artifact. This produces the following structure in the published package:But
node-gyp-buildexpects:Suggested Fix
Add
merge-multiple: trueto thedownload-artifactstep in thepublishjob:This merges all artifacts flat into
prebuilds/, producing theprebuilds/{platform}-{arch}/structure thatnode-gyp-buildexpects.Environment
@napi-ffi/ref-napi: 3.0.7