Pack a JavaScript local project to a portable executable.
# build your project first
npm run build
# pack current project
npm2exe .
# pack other project
npm2exe path/to/projectOptions:
--arch <x86|ia32|x64|arm|arm64>target runtime architecture (ia32maps tox86,armmaps toarmv7l)--platform <linux|darwin|win|win32>target platform (default current platform)--node-version <version>specific runtime version (for examplev22.18.0)--output <name>output bundle file name (default package name; Windows appends.exe)--compression-level <0-9>compression level (default0, no compression; higher levels trade speed for a smaller archive)--verboseor-Venable Verbose output
npm2exe reads your package.json#bin, installs only production dependencies into a temporary app directory, downloads a matching stock Node.js runtime, then wraps both into a self-extracting package.
In short: SEA, pkg, and nexe lean toward a tighter single-binary image, while caxa and npm2exe lean toward extracting and running a real app tree. That makes npm2exe especially friendly to regular Node.js install behavior and workspace: monorepos.
cd path/to/your/project
npx git-utility download https://github.com/idea2app/npm2exe main .github/workflows/ .github/workflows/Notes:
- The downloaded workflow example keeps a single packaging step, so no per-OS
shellswitching is needed. - Build on each native runner instead of cross-packaging from one host, because
npm2execurrently uses different wrapping backends for Windows and POSIX targets. - Linux/macOS outputs are self-extracting shell archives; Windows output is a self-extracting
.exe. - The release asset is the installer wrapper. The final launcher gets installed into the user home/profile when the asset is executed.
- Code signing, notarization, and checksum publishing are intentionally left to the application repository.
