Skip to main content
Add one or more packages to your project’s dependencies.

Usage

ant add <package[@version]>... [options]
ant a <package[@version]>... [options]

Parameters

package
string
required
Package specification to add.Formats:
  • package-name - Latest version
  • [email protected] - Specific version
  • package-name@^1.0.0 - Version range
  • package-name@next - Dist tag
  • @scope/package-name - Scoped package

Options

-g, --global
boolean
Install globally to ~/.ant/pkg/global.
-D, --save-dev
boolean
Add as devDependency instead of dependency.
--verbose
boolean
Enable verbose output.
-h, --help
boolean
Display help information.

Examples

Add a package

ant add express
Output:
ant add v1.0.0 (abc123)

installed [email protected] with binaries:
 - express

52 packages installed [892ms] done

Add multiple packages

ant add react react-dom

Add specific version

Add with version range

ant add express@^4.0.0

Add dev dependencies

ant add -D typescript @types/node jest
Output:
ant add -D v1.0.0 (abc123)

installed [email protected]
installed @types/[email protected]
installed [email protected] with binaries:
 - jest

284 packages installed [2.1s]

Add from dist tag

ant add react@next

Global installation

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

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

[156ms] done

Version Resolution

When no version is specified, Ant installs the latest stable version:
ant add lodash
# Installs latest: [email protected]

Update Hints

If a newer version is available, Ant shows a hint:
+ [email protected] (v4.18.3 available)

Binary Linking

Packages with binaries are automatically linked to node_modules/.bin (or ~/.ant/bin for global installs):
installed [email protected] with binaries:
 - tsc
 - tsserver

Build docs developers (and LLMs) love