Open MGMehdi opened 10 months ago
Yeah, the part where it says that it only supports built-in modules.
Yes, for now you would need to bundle your code into one single file that only requires builtins before injecting it into the SEA.
Hooo I didn't understand like that. Thanks for the clarification!
For now if I want to achieve the same results is by using pkg
by vercel?
FYI pkg has been archived now. I'm maintaining the most active fork here: https://github.com/yao-pkg/pkg
If you need ESM support there some alternatives: https://github.com/yao-pkg/pkg/issues/16#issuecomment-1945486658
This will works if you do a build with just one file.
Install esbuild:
npm install --save-exact --save-dev esbuild
Copy to package.json:
"scripts": {
"build": "esbuild your-start-file.js --bundle --platform=node --outfile=out.js"
}
generate out.js :
npm run build
Then resumes the whole process from https://nodejs.org/api/single-executable-applications.html for out.js
This will works if you do a build with just one file. Install esbuild:
npm install --save-exact --save-dev esbuild
Copy to package.json:"scripts": { "build": "esbuild your-start-file.js --bundle --platform=node --outfile=out.js" }
generate out.js :
npm run build
Then resumes the whole process from https://nodejs.org/api/single-executable-applications.html for out.js
In my case I need to package a application that uses the serialport
module. The compiled version throws the following error:
Error: No native build was found for platform=win32 arch=x64 runtime=node abi=127 uv=1 libc=glibc node=22.2.0
This will works if you do a build with just one file. Install esbuild:
npm install --save-exact --save-dev esbuild
Copy to package.json:"scripts": { "build": "esbuild your-start-file.js --bundle --platform=node --outfile=out.js" }
generate out.js :
npm run build
Then resumes the whole process from https://nodejs.org/api/single-executable-applications.html for out.js
I followed the steps you provided and successfully resolved a fast-csv
built-in module not found issue.
The generated exe runs without an error on Windows 10 64-bit.
@robertsLando I've tried your esbuild.js file, but it's not works for me :(, I'm having issue with usb
package
Hello, I tried to compile my express app following the
Single executable applications
guide in but I've got this error :It also appear with Node.js v20.10.0.
The app is written with typescript but the build is working when running in the terminal. Here is the
tsconfig.json
Did I miss something ?