Skip to main content
Install dependencies defined in package.json from the lockfile, or add new packages when specified.

Usage

ant install [packages...] [options]
ant i [packages...] [options]

Parameters

packages
string[]
Package specifications to install. When provided, behaves like ant add.Formats:
  • package-name - Latest version
  • package-name@version - Specific version
  • package-name@tag - Dist tag (e.g., @next, @beta)

Options

-g, --global
boolean
Install packages globally to ~/.ant/pkg/global.
-D, --save-dev
boolean
Add packages as devDependencies.
--verbose
boolean
Enable verbose output with detailed progress information.
-h, --help
boolean
Display help information.

Examples

Install from lockfile

ant install
Output:
ant install v1.0.0 (abc123)

5 packages installed [245ms]

Install and add packages

ant install express lodash
Output:
ant install v1.0.0 (abc123)

+ [email protected]
+ [email protected]

52 packages installed [892ms]

Install as dev dependency

ant install -D typescript @types/node

Global installation

ant install -g pm2
Output:
ant add -g v1.0.0 (abc123)

installed globally pm2
  (binaries linked to ~/.ant/bin)

[156ms] done

No changes needed

ant install
Output:
ant install v1.0.0 (abc123)

Checked 52 installs across 52 packages (no changes) [89ms]

Behavior

Without packages argument

  • Installs from existing lockfile if present
  • Resolves and creates lockfile if none exists
  • Requires package.json in current directory

With packages argument

  • Adds packages to package.json
  • Updates lockfile
  • Installs all dependencies

Lockfile

Ant uses ant.lockb (binary format) for faster parsing and smaller size.

Cache

Installed packages are cached in ~/.ant/pkg/cache for faster subsequent installs.

Lifecycle Scripts

If packages have lifecycle scripts (postinstall, etc.), Ant will prompt:
2 packages need to run lifecycle scripts:
  • puppeteer (node install.js)
  • esbuild (node install.js)

Run: ant trust <pkg> or ant trust --all

Build docs developers (and LLMs) love