@vercel/cli-exec
v0.1.1
Published
Helpers for locating and executing the Vercel CLI
Keywords
Readme
@vercel/cli-exec
Helpers for locating and executing the Vercel CLI from other Node packages.
API
findVercelCli(options?)
Resolves the Vercel CLI executable without running it.
- Prefers the nearest
node_modules/.bin/vercel - Falls back to the provided
PATH - Returns
nullwhen no usable CLI installation is found
execVercelCli(args, options?)
Resolves and runs the Vercel CLI, returning:
stdoutstderrinvocation
It preserves access to local node_modules/.bin entries and Node itself even
when the caller passes a sanitized PATH.
clearVercelCliCache()
Clears cached CLI lookups. Use this when a long-lived process needs to pick up an install or uninstall that happened after an earlier resolution attempt.
VercelCliError
Thrown when resolution or execution fails. The code field is one of:
VERCEL_CLI_INVALID_CWDVERCEL_CLI_NOT_FOUNDVERCEL_CLI_PERMISSION_DENIEDVERCEL_CLI_ERROREDVERCEL_CLI_TIMED_OUTVERCEL_CLI_CANCELEDVERCEL_CLI_SIGNALEDVERCEL_CLI_EXEC_FAILED
Available fields:
message: human-readable error messagecode: stable machine-readable error codeinvocation: resolved CLI command metadata when a command was selectedstdout: captured standard output when the child process produced outputstderr: captured standard error when the child process produced outputexitCode: numeric exit code for non-zero process exitscause: original underlying error when available
