ConfigsJul 28, 2026·3 min read

Nexe — Create Single Executables from Node.js Applications

A tool that compiles Node.js applications into a single portable executable. Distribute your CLI tools and servers without requiring users to install Node.js or npm.

Agent ready

Ready-to-run agent install

This asset can be installed after the agent chooses its runtime, checks the plan, and runs the matching command.

Native · 98/100Policy: allow
Agent surface
Any MCP/CLI agent
Kind
Skill
Install
Single
Trust
Trust: Established
Entrypoint
Nexe
Direct install command
npx -y tokrepo@latest install 8718379f-8aa2-11f1-9bc6-00163e2b0d79 --target codex

Run after dry-run confirms the install plan.

Introduction

Nexe compiles your Node.js application into a single standalone executable binary. The resulting file bundles the Node.js runtime and your source code together, so end users can run your tool without installing Node.js, npm, or any dependencies.

What Nexe Does

  • Compiles Node.js apps into standalone executables for Windows, macOS, and Linux
  • Bundles the Node.js runtime with your application code into one file
  • Supports cross-compilation to build binaries for different platforms
  • Handles native modules and node_modules automatically
  • Provides resource embedding for including static assets in the binary

Architecture Overview

Nexe downloads or builds a patched Node.js binary, then appends your application bundle to it. At runtime, the patched binary detects the appended payload and executes it instead of entering the REPL. Dependencies from node_modules are resolved and bundled during compilation. Native addons (.node files) are extracted to a temp directory at runtime.

Self-Hosting & Configuration

  • Install globally: npm install -g nexe
  • Compile with defaults: nexe index.js produces an executable in the current directory
  • Target a specific Node version: nexe -t 20.11.0
  • Cross-compile: nexe -t linux-x64-20.11.0 from any platform
  • Include extra resources: nexe -r "assets/**/*" to bundle static files

Key Features

  • Single-file distribution with no runtime dependencies
  • Cross-platform builds for Linux, macOS, and Windows
  • Configurable Node.js version targeting
  • Resource embedding for assets, templates, and config files
  • Cached Node.js builds for faster recompilation

Comparison with Similar Tools

  • pkg (Vercel) — Similar approach but now deprecated; Nexe remains actively maintained
  • esbuild + Node SEA — Node 20+ built-in single executable feature; less mature but native
  • Bun build --compile — Bun's built-in compiler; requires Bun runtime ecosystem
  • Deno compile — Deno's native compilation; only for Deno projects

FAQ

Q: Does Nexe support native Node.js addons? A: Yes, but native addons are extracted to a temporary directory at runtime. Some addons with hardcoded paths may need adjustment.

Q: How large are the output binaries? A: Binaries are typically 30-50 MB since they include the full Node.js runtime. Compression and tree-shaking can reduce this.

Q: Can I compile for a different OS from my current machine? A: Yes. Use the -t flag with the target platform: nexe -t win32-x64 from Linux or macOS.

Q: Does Nexe work with TypeScript? A: Nexe compiles JavaScript. Transpile TypeScript to JavaScript first using tsc or esbuild, then pass the output to Nexe.

Sources

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets