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

Standalone Binaries cannot be created for Node 20+ #393

Open
geographika opened this issue Jun 20, 2024 · 3 comments
Open

Standalone Binaries cannot be created for Node 20+ #393

geographika opened this issue Jun 20, 2024 · 3 comments

Comments

@geographika
Copy link
Collaborator

geographika commented Jun 20, 2024

The pkg module used to create standalone binaries has been deprecated. It appears it can only build binaries using version 18 of node or lower.
The GeoStyler parsers use some newer node functionality such as structuredClone, causing errors such as:

ReferenceError: structuredClone is not defined

This was introduced in Node17 so is included in Node18, so the releases seem fine for now.
In order to continue building binaries in newer versions of node beyond v18 a new approach is required.
Node itself has a new experimental feature that could be used: https://nodejs.org/api/single-executable-applications.htm

A few other links:

https://github.com/nodejs/single-executable/discussions
ChainSafe/lodestar#3633 (comment)
https://github.com/nodejs/single-executable/blob/main/docs/existing-solutions.md
https://github.com/mongodb-js/boxednode

@KaiVolland
Copy link
Contributor

I'd also suggest to try https://bun.sh/docs/bundler/executables

@geographika
Copy link
Collaborator Author

Thanks, @KaiVolland - this looks an easier approach than the others. Is there a general move from node to bun across all GeoStyler projects? I presume we could just use bun for making the executables and leave the rest of the CI scripts running on node.

For reference I found some notes on using bun for executables at https://github.com/llimllib/node-esbuild-executable?tab=readme-ov-file#comparison-with-bun

@KaiVolland
Copy link
Contributor

I don't think that there will be a general move to bun. Maybe at some point we will force a change to bun, but as all the build stuff is complex, time consuming and very essentiell i think we should keep the stuff that is already working.

If bun has reached a more stable state I'd love to move the tests to bun as they run like 100 times faster then JEST or vitest.

So your right. We should try if bun can help us with the creation of the exectuables but keep the rest as is.

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

2 participants