Skip to main content
Every package manager operation in Ant is a subcommand of the ant binary. You do not need a separate tool. The table below lists every available command; the sections that follow document each one in detail.
CommandAliasSummary
initCreate a new package.json
installiInstall dependencies from the lockfile
updateupRe-resolve dependencies and refresh the lockfile
addaAdd a package to dependencies
removermRemove a package from dependencies
trustRun lifecycle scripts for packages
runRun a script from package.json
execxRun a command from node_modules/.bin
whyexplainShow why a package is installed
infoShow package information from the registry
lslistList installed packages
cacheManage the package cache
createScaffold a project from a template

Typical workflow

Here is the standard sequence for bootstrapping and running an Ant project:
ant init
ant add hono
ant run start
ant init writes package.json, ant add hono resolves and installs the package from the npm registry and writes ant.lockb, and ant run start executes the start script defined in package.json.

init

Creates a new package.json in the current directory. If a terminal is attached, Ant prompts you for a package name, version, and entry point. If stdin is not a TTY (for example in a CI script), it uses sensible defaults derived from the directory name.
ant init
Running ant init in a directory named my-app with no TTY produces:
package.json
{
  "name": "my-app",
  "version": "1.0.0",
  "type": "module",
  "main": "index.js",
  "scripts": {
    "start": "ant index.js"
  },
  "dependencies": {},
  "devDependencies": {}
}
ant init will fail if a package.json already exists in the current directory.

install

Alias: i Installs all packages listed in package.json. If ant.lockb is present, Ant uses the exact versions recorded there. If no lockfile exists, Ant resolves versions from the semver ranges in package.json and creates one.
ant install
-g
flag
Install packages globally to ~/.ant/pkg/global instead of the local node_modules.
-D
flag
Save the package as a devDependency (only applies when package names are also provided).
You can also pass package names directly to ant install to add them:
# Install all deps from lockfile
ant install

# Add express as a dependency (equivalent to ant add express)
ant install express

# Add typescript as a devDependency
ant install -D typescript
When you pass package names to ant install, the behavior is identical to ant add. The dedicated ant add command is preferred for clarity.

update

Alias: up Re-resolves all dependencies from their semver ranges in package.json and writes a refreshed ant.lockb. Use this when you want to pick up newer patch or minor versions within the declared ranges.
ant update
You can target specific packages instead of updating everything:
# Update everything
ant update

# Update only hono
ant update hono

# Update hono and elysia
ant update hono elysia
Run ant update after bumping version ranges in package.json by hand, or periodically to pull in security patches.

add

Alias: a Adds one or more packages to your project, resolves the full dependency tree, installs to node_modules, and updates both package.json and ant.lockb.
ant add <package[@version]>...
package
string
required
Package name, optionally with a version specifier: hono, hono@4.12.9, hono@^4.
-D
flag
Save to devDependencies instead of dependencies.
-g
flag
Install globally to ~/.ant/pkg/global. Binaries are linked to ~/.ant/bin.
-D
flag
Save to devDependencies instead of dependencies.
-g
flag
Install globally to ~/.ant/pkg/global. Binaries are linked to ~/.ant/bin.
# Add a runtime dependency
ant add hono

# Pin to an exact version
ant add hono@4.12.9

# Add a dev dependency
ant add -D @types/node

# Add multiple packages at once
ant add hono elysia

# Install globally
ant add -g typescript

remove

Alias: rm Removes one or more packages from package.json, uninstalls them from node_modules, and refreshes ant.lockb.
ant remove <package>...
package
string
required
The name of the package to remove.
-g
flag
Remove from global packages at ~/.ant/pkg/global.
# Remove a local package
ant remove hono

# Remove a global package
ant remove -g typescript

trust

Some npm packages define postinstall or other lifecycle scripts. Ant does not run these automatically — you must explicitly trust a package before its scripts execute. This prevents supply-chain attacks from silently running arbitrary code after install.
ant trust [package...]
ant trust --all
package
string
One or more package names to trust and run lifecycle scripts for.
--all
flag
Trust and run lifecycle scripts for all packages that have pending scripts.
# See which packages have pending lifecycle scripts
ant trust

# Trust a specific package
ant trust esbuild

# Trust all pending packages at once
ant trust --all
After you run ant trust <pkg>, Ant adds the package name to a trustedDependencies field in package.json so subsequent installs run its scripts automatically.

run

Runs a named script from the scripts field in package.json. Pass -- before any extra arguments you want forwarded to the script.
ant run <script> [args...]
script
string
required
The script name as defined in package.json.
# Run the start script
ant run start

# Run with extra arguments
ant run build -- --watch

# List all available scripts
ant run
If a script name does not conflict with an Ant subcommand, you can run it directly without the run prefix — for example ant start when start is in scripts.

exec

Alias: x Runs a binary from node_modules/.bin. If the binary is not installed locally, Ant searches the global package directory and, if still not found, temporarily downloads the package from the registry and executes it.
ant exec <command> [args...]
ant x <command> [args...]
command
string
required
The binary name to execute.
--ant
flag
Run the binary with ant as the interpreter instead of the system’s default node-compatible runner.
# Run tsc from node_modules/.bin
ant x tsc --version

# Run a binary with ant as interpreter
ant x --ant tsx src/index.ts

# Download and run a package without installing it
ant x create-hono my-app
The antx binary is a shorthand for ant x:
antx tsc --noEmit

why

Alias: explain Shows which packages in the dependency tree depend on a given package. Reads from ant.lockb, so you must have a lockfile already.
ant why <package>
ant explain <package>
package
string
required
The package name to explain.
ant why hono
Example output:
hono@4.12.9

  └ package.json (dependencies)

info

Fetches and displays metadata for a package from the npm registry: description, license, dependency count, dist tags, tarball URL, integrity hash, and maintainers.
ant info <package[@version]>
package
string
required
Package name, optionally with a version specifier.
# Info for the latest version
ant info hono

# Info for a specific version
ant info hono@4.12.9

ls

Alias: list Lists the direct dependencies installed in the current project, along with their resolved versions.
ant ls
ant list
-g
flag
List globally installed packages from ~/.ant/pkg/global.
# List local packages
ant ls

# List global packages
ant ls -g

cache

Manages the local package cache stored at ~/.ant/pkg. The cache speeds up installs by avoiding redundant registry fetches and tarball downloads.
ant cache <subcommand>

Subcommands

Shows the cache location, number of cached packages, total size on disk, and database size.
ant cache info
Example output:
Cache location: ~/.ant/pkg
Packages:       142
Size:           87.34 MB
DB size:        1.20 MB
Removes packages from the cache that have not been accessed in more than days days. Defaults to 30 days if no argument is given.
# Prune entries older than 30 days (default)
ant cache prune

# Prune entries older than 7 days
ant cache prune 7
Flushes any pending writes and synchronizes the cache database to disk.
ant cache sync

create

Scaffolds a new project from an npm template package or a GitHub repository.
ant create <template> [dest] [...flags]
ant create <github-org/repo> [dest] [...flags]
template
string
required
Either a short template name (Ant prepends create- and runs it via ant x) or a org/repo GitHub path.
dest
string
Destination directory. Defaults to the repository or template name.
For npm-style templates, Ant runs ant x create-<template> with the remaining arguments. This is equivalent to npx create-<template>.
# Scaffold with create-hono
ant create hono my-app

# Scaffold with create-next-app
ant create next-app