Skip to content

pkgNode.js to single executable

Ship your Node.js project as one self-contained binary. No runtime install. No npm. Just run.

pkg

Looking for vercel/pkg? This is yao-pkg/pkg — the actively maintained fork. The original vercel/pkg is archived. @yao-pkg/pkg is a drop-in replacement — rename the dep and keep shipping. See the migration guide.

npm version npm downloads GitHub stars CI license

Terminal recording: pkg index.js produces linux, macos, and windows binaries in one second
One command. Three binaries. Runs on machines without Node.js installed.

Quick install

sh
npm install -g @yao-pkg/pkg

Requires Node.js >= 22 on the build host.

Your first binary

sh
pkg index.js
sh
pkg .
js
const { exec } = require('@yao-pkg/pkg');
await exec(['index.js', '--target', 'host', '--output', 'app']);

pkg reads package.json, follows the bin entry, walks your dependencies, and produces executables for Linux, macOS, and Windows.

Want to target a specific platform?

sh
pkg -t node22-linux-arm64 index.js

Standard or SEA?

Two build modes: Standard (pkg .) gives you bytecode protection and compression; Enhanced SEA (pkg . --sea) runs on stock Node.js with no patches. Pick via SEA vs Standard.

Why pkg?

  • Commercial apps — ship without sources
  • CLI tools — distribute one binary, no npm install on user machines
  • Demos & trials — no runtime, no dependencies to break
  • Self-extracting installers — one file, portable
  • Edge & containers — smaller, faster deploys

See the full use cases

Released under the MIT License.