yao-pkg / pkg

Package your Node.js project into an executable
https://www.npmjs.com/package/@yao-pkg/pkg
MIT License
312 stars 11 forks source link

fix: add missing arch to nativePrebuildInstall cache #9

Closed segevfiner closed 9 months ago

segevfiner commented 9 months ago

Otherwise when packaging for multiple architectures, pkg might end up picking up a cached binary for a different arch.

In general that code is a bit finicky and it will only really work for packages that actually use prebuild-install, and currently also fails for any prebuild napi package, as you need to pass -r/--runtime napi to prebuild-install for that to work, which is a different bug.

I'm currently just doing my own workarounds for native packages that this doesn't handle (e.g. pnpm rebuild, or pnpm install --force, before invoking pkg per target, rather than for all targets at once. It would have been much nicer if there was a more general way to handle this or to give per package hooks to pkg to handle packages with special requirements.

Contributed on behalf of Swimm