Skip to content

CLI overview ​

text
craft [OPTIONS] [COMMAND]

Commands ​

CommandAliasesDoes
installiInstall the project's dependencies; with package names, add them like craft add
addAdd packages to package.json and install them
removerm, uninstall, unRemove packages from package.json and node_modules
updateup, upgradeUpdate dependencies within their specifiers, or to their latest versions with --latest
outdatedShow direct dependencies with newer versions available
listlsList the project's dependencies, and theirs with --depth
whyShow every chain of dependencies that installs a package
runRun a package.json script, or list them when no name is given
startRun the start script
testtRun the test script
execRun a bin from the project's dependencies
dlxxRun a package's bin without adding it to the project
trustAllow packages to run install scripts, then install
initCreate a package.json in the current directory
ciRemove node_modules and install exactly what craft.lock records
cache cleanRemove every stored package and cached registry response

Any other word runs the script of that name, or else the dependency bin of that name: craft build, craft vitest --run. See craft run.

With no command, craft runs craft install.

Global options ​

These work with every command, before or after it.

OptionDoes
-v, --versionPrint the version
-h, --helpPrint help; craft <command> --help for a command
--debugPrint debug logs of what craft is doing. Credentials are redacted.
-s, --silentPrint nothing but warnings and errors
--offlineUse only cached registry metadata and stored packages; never touch the network
--prefer-offlineUse cached registry metadata without revalidating it; fetch only what is missing

--debug and --silent can't be combined, and neither can --offline and --prefer-offline.

Output ​

On a terminal, craft shows one live status line while it works (Resolving dependencies… 143 packages, Linking 218 packages), then a summary of what changed in your direct dependencies:

text
+ react 19.2.0
+ vitest 3.2.4 (dev)
- lodash 4.17.21
~ typescript 5.6.3 → 5.9.3
218 packages installed in 1.9s

When stderr isn't a terminal, in CI, or with --debug, the status line is replaced by plain output. Warnings and errors always go to stderr.

Exit codes ​

CodeMeaning
0Success
1craft failed; the message says why
otherA script or bin failed with this code, which craft passes through. A script killed by a signal reports 128 + the signal number.

Released under the MIT License.