Configs2026年7月28日·1 分钟阅读

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 就绪

Agent 可直接安装

这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
Nexe
直接安装命令
npx -y tokrepo@latest install 8718379f-8aa2-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run 确认安装计划,再运行此命令。

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

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产