Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"No native build was found" for node-gyp-build when bundling with esbuild #53

Open
r-token opened this issue Oct 4, 2022 · 3 comments

Comments

@r-token
Copy link

r-token commented Oct 4, 2022

I've started bundling my code with esbuild, but some of my dependencies use node-gyp-build. These two don't seem to play well together at the moment. I can successfully bundle the code with esbuild, but things break at runtime.

At runtime, the code that uses node-gyp-build throws an error that says: Error: No native build was found for platform=linux arch=x64 runtime=node abi=93 uv=1 libc=glibc node=16.16.0. It looks like that message comes from here.

The error stack also references dependencies including sodium-native, sodium-universal and others. But I believe the problem stems from node-gyp-build.

Is this something that can be addressed here? I don't understand the actual issue, and can't find much help online for it. So any clarity on this would be wonderful.

esbuild settings (if that's helpful):

  • platform: node
  • target: node16
  • bundle: true
@r-token r-token changed the title "No native build was found" for node-gyp-build "No native build was found" for node-gyp-build when bundling with esbuild Oct 4, 2022
@Julusian
Copy link
Contributor

Julusian commented Dec 9, 2022

Related to #22?

@MagdielCAS
Copy link

This issue seems a bit old, but since I stumbled here as well while searching for a fix I will leave my findings.
I was having the exact same issue with the same dependencies, after some time I was able to fix it by adding the following esbuild config:

platform: "node",
packages: "external",
entryPoints: ['path/to/index.ts'],

@colin-grant-work
Copy link

packages: "external",

This tells ESBuild to treat all of your NPM dependencies as external dependencies, i.e. not to bundle them. This is fine if your goal with ESBuild is not bundling but just (maybe) minifying your own code or something along those lines, but still means you can't use it as a bundler for anything that uses node-gyp-build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants