Commands
Complete guide to snpm commands
Complete reference for all snpm commands.
Global Flags
All commands support these global flags:
-v, --verbose- Enable verbose logging for debugging
Example:
snpm install --verbose
snpm add react --verboseinstall
Install dependencies from package.json.
snpm install [packages...]Options:
--production- Skip dev dependencies--frozen-lockfile(alias:--immutable) - Fail if lockfile needs updates-f, --force- Force re-download all packages-w, --workspace <name>- Install in specific workspace project
Examples:
# Install all dependencies
snpm install
# Install specific packages
snpm install react react-dom
# Production install
snpm install --production
# CI install (strict lockfile)
snpm install --frozen-lockfile
# Install in workspace project
snpm install -w uiadd
Add packages to your project.
snpm add <packages...>Options:
-D, --dev- Add as dev dependency-g, --global- Install globally-f, --force- Force re-download-w, --workspace <name>- Add to specific workspace project
Examples:
# Add package
snpm add react
# Add specific version
snpm add react@18.2.0
# Add as dev dependency
snpm add -D typescript
# Add multiple packages
snpm add react react-dom
# Add to workspace project
snpm add react -w uiremove
Remove packages from your project.
snpm remove <packages...>Examples:
# Remove package
snpm remove react
# Remove multiple packages
snpm remove react react-domrun
Run a script from package.json.
snpm run <script> [-- <args>]Options:
-r, --recursive- Run in all workspace projects--filter <pattern>- Run in filtered workspace projects (supports globs)--skip-install- Skip automatic install check before running
Examples:
# Run script
snpm run build
# Pass arguments
snpm run test -- --watch
# Run in all workspaces
snpm run build --recursive
# Run in filtered workspaces
snpm run test --filter "ui"
snpm run build --filter "app-*"upgrade
Update packages to their latest versions.
snpm upgrade [packages...]Options:
--production- Only upgrade production dependencies-f, --force- Force re-download
Examples:
# Upgrade all packages
snpm upgrade
# Upgrade specific packages
snpm upgrade react react-dom
# Upgrade production only
snpm upgrade --productionoutdated
Check for outdated packages.
snpm outdatedOptions:
--production- Only check production dependencies
Shows a table of packages with newer versions available.
dlx
Download and execute a package binary without installing it.
snpm dlx <package> [args...]Alias: spx is available as a shorthand (e.g., spx cowsay).
Examples:
# Run cowsay
snpm dlx cowsay "Hello World"
# Run specific version
snpm dlx cowsay@latest "Hello World"
# Construct specific commands
snpm dlx create-react-app my-app
# Use the spx alias
spx cowsay "Moo"init
Initialize a new package.json.
snpm initCreates a basic package.json in the current directory.
login
Authenticate with an npm registry.
snpm loginOptions:
--registry <url>- Registry URL (defaults to npmjs.org)--token <token>- Auth token (prompts if not provided)--scope <scope>- Associate scope with registry (e.g., @myorg)--web- Use web-based authentication
Examples:
# Login to default registry
snpm login
# Login with token
snpm login --token npm_xxxxxxxxxxxxx
# Login to private registry
snpm login --registry https://npm.mycompany.com
# Login with scope
snpm login --scope @myorg --registry https://npm.mycompany.com
# Web-based login
snpm login --weblogout
Remove registry credentials.
snpm logoutOptions:
--registry <url>- Registry URL (defaults to npmjs.org)--scope <scope>- Remove credentials for specific scope
Examples:
# Logout from default registry
snpm logout
# Logout from specific registry
snpm logout --registry https://npm.mycompany.com
# Logout from scoped registry
snpm logout --scope @myorgexec
Execute a command with node_modules/.bin in PATH.
snpm exec <command> [args...]Options:
-c, --shell-mode- Run command through shell (enables pipes, redirects, etc.)-r, --recursive- Run in all workspace projects--filter <pattern>- Filter workspace projects by name--skip-install- Skip automatic install check before executing
Examples:
# Run a binary from node_modules
snpm exec tsc --version
# Run with shell features
snpm exec -c "eslint src/**/*.ts | head -20"
# Run in all workspaces
snpm exec --recursive tsc --buildlist
List installed packages.
snpm listOptions:
-g, --global- List globally installed packages
Examples:
# List local dependencies
snpm list
# List global packages
snpm list -gpatch
Modify installed packages to fix bugs or customize behavior. Patches are saved and automatically applied on subsequent installs.
snpm patch <subcommand>patch edit
Prepare a package for patching.
snpm patch edit <package[@version]>Alias: snpm patch start
Examples:
# Prepare lodash for patching
snpm patch edit lodash
# Patch a specific version
snpm patch edit lodash@4.17.21patch commit
Create a patch from your modifications.
snpm patch commit <path>Examples:
# After editing, commit the patch
snpm patch commit .snpm-patch/lodash@4.17.21patch remove
Remove a patch for a package.
snpm patch remove <package>patch list
List all patches in the current project.
snpm patch listclean
Remove cached packages and metadata to free disk space.
snpm cleanOptions:
-y, --yes- Skip confirmation prompt--dry-run- Show what would be deleted without deleting--packages- Only clean cached packages--metadata- Only clean registry metadata cache--global- Also clean global packages and binaries--all- Clean everything (packages, metadata, and global)
Examples:
# Interactive clean (prompts for confirmation)
snpm clean
# Clean without prompts
snpm clean -y
# Preview what would be cleaned
snpm clean --dry-run
# Clean only cached packages
snpm clean --packages
# Clean everything including global installs
snpm clean --allconfig
Show the resolved configuration and runtime paths.
snpm configThis prints cache/data locations, registry/auth info, install settings (hoisting, link backend, strict peers, frozen lockfile default, min package age, registry concurrency), script allowlist, and logging status.
Examples:
snpm config