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

Runtime issue with loadable extensions when using ncc for single-file builds #174

Open
tn233 opened this issue Jan 15, 2025 · 0 comments
Open

Comments

@tn233
Copy link

tn233 commented Jan 15, 2025

I ran into a runtime problem when using ncc to compile a single file for executable applications (Node.js): Loadable extension for ... not found. Was the ... package installed?

I dug into it and found out what caused the issue in index.cjs (lines 41–46):

const loadablePath = join(
    __dirname,
    "..", // this was the problem for me
    packageName,
    `${ENTRYPOINT_BASE_NAME}.${extensionSuffix(platform)}`
  );

To fix it, I copied the extension directory to the parent directory of the working directory, and it worked.

It might be helpful to add an optional argument like options.nativeBinding in better-sqlite3, or maybe automatically look for files in the current working directory. But I’m not sure if that would make the project more complicated. (By the way, I couldn’t even find the repository for this javascript glue code.)

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

1 participant