CLI Reference
Complete command-line reference for snpm
Complete reference for all snpm commands and options.
Global Flags
These flags can be used with any command:
-v, --verbose- Enable verbose logging output
Example:
snpm install --verbose
snpm add react --verboseCommands
install
snpm install [packages...]Install dependencies from package.json or add specific packages.
Options:
--production- Skip dev dependencies--frozen-lockfile,--immutable- Fail if lockfile needs updates-f, --force- Force re-download all packages-w, --workspace <name>- Target specific workspace project
add
snpm add <packages...>Add packages to dependencies.
Options:
-D, --dev- Add as dev dependency-g, --global- Install globally-f, --force- Force re-download-w, --workspace <name>- Target specific workspace project
remove
snpm remove <packages...>Remove packages from the project.
run
snpm run <script> [-- <args>]Run a script from package.json.
Options:
-r, --recursive- Run in all workspace projects--filter <pattern>- Run in filtered workspace projects (supports globs)--skip-install- Skip automatic install check
upgrade
snpm upgrade [packages...]Update packages to their latest versions within semver constraints.
Options:
--production- Only upgrade production dependencies-f, --force- Force re-download
outdated
snpm outdatedCheck for outdated packages.
Options:
--production- Only check production dependencies
dlx
snpm dlx <package> [args...]Download and execute a package binary. Alias: spx.
exec
snpm exec <command> [args...]Execute a command with node_modules/.bin in PATH.
Options:
-c, --shell-mode- Run through shell (pipes, redirects)-r, --recursive- Run in all workspace projects--filter <pattern>- Filter workspace projects--skip-install- Skip automatic install check
list
snpm listList installed packages.
Options:
-g, --global- List globally installed packages
patch
snpm patch <subcommand>Modify installed packages. Subcommands: edit, commit, remove, list.
clean
snpm cleanRemove cached packages and metadata.
Options:
-y, --yes- Skip confirmation--dry-run- Preview without deleting--packages- Only clean packages--metadata- Only clean metadata--global- Also clean global installs--all- Clean everything
init
snpm initInitialize a new package.json.
login
snpm loginAuthenticate with an npm registry.
Supports both Bearer and Basic authentication schemes:
- Bearer: use an auth token via
--tokenor environment variables - Basic: typically provided via web-based login (
--web) where username/password are exchanged for a session token
Options:
--registry <url>- Registry URL (scheme required, e.g. https://; trailing slashes are normalized)--token <token>- Auth token (Bearer scheme)--scope <scope>- Associate scope with registry--web- Use web-based authentication (Basic credentials exchanged for a token)
logout
snpm logoutRemove registry credentials.
Options:
--registry <url>- Registry URL--scope <scope>- Remove credentials for specific scope
config
snpm configShow the resolved configuration and runtime paths.
Environment Variables
| Variable | Description |
|---|---|
SNPM_HOME | Custom home directory for cache and data |
SNPM_REGISTRY | Default registry URL |
NPM_CONFIG_REGISTRY, npm_config_registry | Alternative registry URL (npm compatibility) |
SNPM_MIN_PACKAGE_AGE_DAYS | Minimum package age in days |
SNPM_MIN_PACKAGE_CACHE_AGE_DAYS | Metadata cache age in days |
SNPM_HOIST | Hoisting mode: none, single-version, all |
SNPM_LINK_BACKEND | Link strategy: auto, hardlink, symlink, copy |
SNPM_STRICT_PEERS | Fail on peer dependency conflicts |
SNPM_FROZEN_LOCKFILE | Default frozen lockfile mode |
SNPM_REGISTRY_CONCURRENCY | Max concurrent registry requests |
SNPM_ALLOW_SCRIPTS | Comma-separated list of packages allowed to run install scripts |
SNPM_VERBOSE | Enable verbose logging |
SNPM_LOG_FILE | Custom log file path |
NPM_TOKEN, SNPM_AUTH_TOKEN, NODE_AUTH_TOKEN | Registry authentication token (Bearer) |
Examples
Basic Usage
# Install dependencies
snpm install
# Add packages
snpm add react react-dom
snpm add -D typescript
# Remove packages
snpm remove lodash
# Run scripts
snpm run build
snpm run test -- --watch
# Upgrade packages
snpm upgrade
snpm upgrade react
# Check for updates
snpm outdatedWorkspaces
# Install all workspace packages
snpm install
# Install in specific workspace
snpm install -w ui
# Add to specific workspace
snpm add react -w ui
# Run in all workspaces
snpm run build --recursive
# Run in filtered workspaces
snpm run test --filter "ui"
snpm run build --filter "app-*"CI/CD
# Frozen lockfile (fail if out of sync)
snpm install --frozen-lockfile
# Production install
snpm install --production --frozen-lockfile
# With security settings
SNPM_MIN_PACKAGE_AGE_DAYS=7 snpm install --frozen-lockfileAuthentication
# Login to default registry
snpm login
# Login with token (Bearer)
snpm login --token npm_xxxxxxxxxxxxx
# Login to private registry (URL must include protocol)
snpm login --registry https://npm.mycompany.com
# Login with scope
snpm login --scope @myorg --registry https://npm.mycompany.com
# Web-based login (Basic credentials exchanged for token)
snpm login --web
# Logout
snpm logoutExit Codes
| Code | Meaning |
|---|---|
0 | Success |
1 | Error |
Comparison with npm
| npm | snpm |
|---|---|
npm install | snpm install |
npm install <pkg> | snpm add <pkg> |
npm uninstall <pkg> | snpm remove <pkg> |
npm update | snpm upgrade |
npm outdated | snpm outdated |
npm run <script> | snpm run <script> |
npm init | snpm init |
npm login | snpm login |
npm logout | snpm logout |