Distribute a command-line tool to non-technical end users as a single downloadable file.
Ship a commercial application without exposing your source code to customers.
Create a cross-platform CLI that users can download and run instantly without installing Node.js.
Deploy a server application as one executable file instead of managing hundreds of dependency folders.
pkg is a command-line tool that bundles a Node.js project into a standalone executable file, a single program that can run on Windows, macOS, or Linux even on machines that don't have Node.js installed. Normally, sharing a Node.js application requires the recipient to install Node.js and then download all the project's dependencies (often hundreds of files). pkg eliminates that friction entirely. It works by scanning your project's code, tracing all the files and dependencies it needs, compiling the JavaScript into an internal format, and embedding everything, including assets like images or templates, into one self-contained binary. You point it at your entry file or package.json, tell it which platforms to target, and it outputs ready-to-run executables. You would use this when distributing a command-line tool to end users who aren't developers, when shipping a commercial app without exposing your source code, when building a cross-platform CLI that people can download and run instantly, or when deploying a server application as a single file instead of a folder of hundreds of modules. Note: the project has been deprecated as of version 5.8.1 and is now archived. The maintainers recommend exploring Node.js 21's built-in support for single executable applications as a modern alternative. The tool is written in JavaScript and targets the Node.js runtime.
Generated 2026-05-18 · Model: sonnet-4-6 · Verify against the repo before relying on details.