Skip to content

nexe

A command-line tool that packages a Node.js app into one executable file.

Stars
13.6k
Forks
554
Licence
MIT
Language
TypeScript
Last update
8 months ago
Type
CLI

What it is

Nexe is a command-line utility that compiles a Node.js application into a single executable file. According to the README, the result can be distributed as a binary without requiring Node or npm on the target machine. The README also lists faster start-up, locking to specific application versions, and cross-platform builds as goals.

  • Compile a server script such as server.js into one executable file with nexe server.js
  • Include a public folder of HTML files with nexe server.js -r "public/**/*.html"
  • Pipe a bundler's output into nexe and set an output name, as shown in the README's stdin example
  • Call nexe from Node code through the compile() function to automate builds

Great for

  • Developers who want to hand a Node.js program to someone without asking them to install Node.js
  • Teams that want to pin and roll back a specific app version as a single file
  • Projects that need to bundle static files such as HTML or assets alongside the app using the resources option
  • Developers comfortable with Node.js tooling who want to customize the Node build

Not ideal for

  • People who only need to run a script on their own machine, since the README does not describe a benefit there
  • Users who cannot install a Node.js build toolchain when they want to use the --build option, since the README says building needs Node's build setup and Python 3
  • Windows users who want a simple setup, because the README's Windows build steps are lengthy and involve PowerShell with administrator rights
Step-by-step guide: how to use nexeInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Node.js and npm

    Install nexe globally with npm

    npm i nexe -g
  2. 2

    Run it

    • Install nexe with the command in the README
    • Run nexe on your entry file, for example nexe my-app.js
    • Run the produced executable on a machine to check that it starts
  3. 3

    Get the most out of it

    • Use -r or --resource with a glob pattern to include files that the app reads with fs.readFile or fs.readFileSync
    • Use --build with --python to build Node from source when a pre-built binary does not suit you
    • Use the -t option to choose a target platform and Node version, as in nexe -t x86-8.0.0
    • Use the Node API compile() with patches to change files before the build
    • Run nexe --help to see the full list of CLI options

Downloads

Strengths

  • Produces a single file, which the README says removes the need for Node or npm on the target machine
  • Offers options to target different platforms and Node versions, and to build Node from source
  • Has a Node API and a command-line interface, so it fits into scripts and build pipelines

Trade-offs

  • Building from source requires Node's own build prerequisites and a suitable Python 3, which the README says is a significant setup step
  • The README describes Windows setup as involved, and some steps are marked as tested only with specific Node versions
  • The README is truncated and does not state the exact supported Node versions or the output file size

How it compares

ProjectStarsTypeLevelUpdatedBest for
nexe (this)13.6kCLIintermediate8 months agoDevelopers who want to hand a Node.js program to someone without asking them to install Node.js
pkg24.3kDev toolintermediate2.8 years agoDevelopers who want to ship a Node.js command-line tool as a single file to users without Node.js
esbuild40.1kDev toolintermediate3 months agoDevelopers who want fast builds for JavaScript, TypeScript, or CSS projects
browserify14.7kDev toolintermediate13 days agoWeb developers who already write Node.js-style CommonJS modules
rolldown14kDev toolintermediate4 days agoDevelopers who already use Rollup plugins and want a faster bundler
plasmo13.2kFrameworkintermediate6 days agoDevelopers building a browser extension for Chrome, Firefox or Edge

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.