Fast, disk space efficient package manager for Node.js with hard links, symlinks, and monorepo support
—
Quality
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Configure pnpm settings, manage Node.js environments, and set up shell integrations for optimal development workflows.
Manage pnpm configuration settings through CLI commands and configuration files.
/**
* Manage pnpm configuration settings
* Supports global, user, and project-level configuration
*/
pnpm config <command> [options]
pnpm c <command> [options]Available Commands:
get <key> - Get configuration valueset <key> <value> - Set configuration valuedelete <key> - Delete configuration keylist - List all configurationedit - Edit configuration fileUsage Examples:
# List all configuration
pnpm config list
# Get specific setting
pnpm config get registry
# Set configuration value
pnpm config set registry https://registry.npmjs.org
# Delete configuration
pnpm config delete proxy
# Edit configuration file
pnpm config editRetrieve specific configuration values or display current settings.
/**
* Get configuration values
* Retrieves settings from config hierarchy
*/
pnpm get <key> [options]Usage Examples:
# Get registry URL
pnpm get registry
# Get store directory
pnpm get store-dir
# Get all settings (same as config list)
pnpm getSet configuration values at different scopes (global, user, project).
/**
* Set configuration values
* Updates configuration files with new values
*/
pnpm set <key> <value> [options]Options:
--global, -g - Set in global config--location <location> - Set in specific config locationUsage Examples:
# Set registry
pnpm set registry https://npm.example.com
# Set global configuration
pnpm set --global store-dir /shared/pnpm-store
# Set package manager settings
pnpm set auto-install-peers true
pnpm set strict-peer-dependencies falsepnpm reads configuration from multiple sources in priority order:
# Configuration priority (highest to lowest)
1. Command line options # --registry=...
2. Environment variables # PNPM_REGISTRY=...
3. Project .pnpmrc # ./pnpmrc or ./.pnpmrc
4. Workspace .pnpmrc # <workspace-root>/.pnpmrc
5. User .pnpmrc # ~/.pnpmrc
6. Global .pnpmrc # /etc/pnpmrc
7. Default values # Built-in defaultsConfiguration file syntax and common settings:
# Registry configuration
registry=https://registry.npmjs.org
@myorg:registry=https://npm.myorg.com
# Store configuration
store-dir=~/.pnpm-store
package-import-method=hardlink
# Installation behavior
auto-install-peers=true
strict-peer-dependencies=false
shamefully-hoist=false
# Workspace settings
link-workspace-packages=true
shared-workspace-lockfile=true
# Logging and output
loglevel=info
reporter=default
# Network settings
fetch-retries=3
fetch-retry-factor=2
fetch-timeout=60000
# Security settings
audit-level=moderateKey configuration settings and their usage:
# Package management
auto-install-peers # Automatically install peer dependencies
strict-peer-dependencies # Fail on missing peer dependencies
shamefully-hoist # Hoist dependencies (not recommended)
public-hoist-pattern # Patterns for public hoisting
# Store and caching
store-dir # Global store directory
cache-dir # Cache directory
package-import-method # hardlink, copy, or clone
verify-store-integrity # Verify packages when adding to store
# Lockfile behavior
lockfile # Generate lockfile (default: true)
lockfile-dir # Lockfile directory
frozen-lockfile # Don't update lockfile
prefer-frozen-lockfile # Prefer existing lockfile
# Registry and network
registry # Default registry URL
fetch-retries # Network retry attempts
fetch-timeout # Network timeout (ms)
ca # Certificate authority
cert # Client certificate
key # Client key
# Workspace configuration
link-workspace-packages # Link workspace packages
shared-workspace-lockfile # Single lockfile for workspaceManage Node.js versions per project with integrated version switching.
/**
* Manage Node.js environments and versions
* Provides Node.js version management similar to nvm
*/
pnpm env <command> [options]Available Commands:
use <version> - Use specific Node.js versionlist - List installed Node.js versionslist-remote - List available remote versionsinstall <version> - Install Node.js versionremove <version> - Remove Node.js versionUsage Examples:
# Install and use Node.js version
pnpm env use 18.17.0
# List installed versions
pnpm env list
# List available remote versions
pnpm env list-remote
# Install specific version
pnpm env install 20.5.0
# Remove version
pnpm env remove 16.20.0Configure project-specific Node.js version requirements.
// package.json - engine requirements
{
"engines": {
"node": ">=18.12.0"
}
}
// .nvmrc - version specification
18.17.0Configuration Options:
# Set Node.js version for project
pnpm config set use-node-version 18.17.0
# Environment variable
export PNPM_NODE_VERSION=18.17.0Set up pnpm environment and shell integrations.
/**
* Setup pnpm environment and shell integration
* Configures PATH, completion, and shell hooks
*/
pnpm setup [options]Options:
--shell <shell> - Specify shell (bash, zsh, fish, powershell)--global - Set up globallyUsage Examples:
# Setup for current shell
pnpm setup
# Setup for specific shell
pnpm setup --shell zsh
# Global setup
pnpm setup --globalShow the directory containing pnpm executables.
/**
* Show path to executable directory
* Returns directory containing pnpm binaries
*/
pnpm bin [options]Options:
--global, -g - Show global bin directoryUsage Examples:
# Show local bin directory
pnpm bin
# Show global bin directory
pnpm bin -g
# Use in scripts
export PATH="$(pnpm bin):$PATH"Show the directory containing installed packages.
/**
* Show path to modules directory
* Returns directory containing node_modules
*/
pnpm root [options]Options:
--global, -g - Show global modules directoryUsage Examples:
# Show local modules directory
pnpm root
# Show global modules directory
pnpm root -g
# Use in scripts
NODE_MODULES=$(pnpm root)Configure different registries for different scopes:
# Set default registry
pnpm set registry https://registry.npmjs.org
# Set scoped registry
pnpm set @myorg:registry https://npm.myorg.com
# Set registry with authentication
pnpm set //npm.myorg.com:_authToken YOUR_TOKENConfigure authentication for private registries:
# Token-based authentication
//registry.npmjs.org/:_authToken=npm_TOKEN
# Username/password authentication
//npm.myorg.com/:username=myuser
//npm.myorg.com/:_password=BASE64_PASSWORD
//npm.myorg.com/:email=user@myorg.com
# Certificate-based authentication
ca=/path/to/ca.pem
cert=/path/to/cert.pem
key=/path/to/key.pemConfigure network behavior for optimal performance:
# Network timeouts and retries
fetch-timeout=60000 # Request timeout in milliseconds
fetch-retries=3 # Number of retry attempts
fetch-retry-factor=2 # Retry delay multiplier
fetch-retry-mintimeout=1000 # Minimum retry delay
fetch-retry-maxtimeout=60000 # Maximum retry delay
# Concurrent connections
network-concurrency=16 # Max concurrent network requestsConfigure caching behavior:
# Cache settings
cache-dir=~/.pnpm-cache # Cache directory
cache-max=Infinity # Maximum cache size
cache-min=0 # Minimum cache retention time
# Offline behavior
prefer-offline=false # Prefer cached packages
offline=false # Work offline onlyConfigure security audit behavior:
# Audit configuration
audit-level=moderate # Audit severity level (low, moderate, high, critical)
audit=true # Enable audit on install
# Package verification
verify-store-integrity=true # Verify package integrityEnforce specific package manager usage:
// package.json - enforce pnpm usage
{
"packageManager": "pnpm@8.6.12",
"engines": {
"pnpm": ">=8.0.0"
}
}Configuration:
# Package manager settings
package-manager-strict=true # Enforce packageManager field
package-manager-strict-version=true # Enforce exact versionUpdate pnpm to the latest version.
/**
* Update pnpm to latest version
* Downloads and installs the latest pnpm release
*/
pnpm self-update [options]Usage Examples:
# Update to latest version
pnpm self-update
# Update to specific version
pnpm self-update 8.7.0Generate shell completion scripts for enhanced CLI experience.
/**
* Generate shell completion script
* Enables tab completion for pnpm commands
*/
pnpm completion [shell] [options]Supported Shells:
bash - Bash completionzsh - Zsh completionfish - Fish completionpowershell - PowerShell completionUsage Examples:
# Generate completion for current shell
pnpm completion
# Generate completion for specific shell
pnpm completion bash > ~/.pnpm-completion.bash
# Install completion for zsh
pnpm completion zsh > ~/.zsh/completions/_pnpmInitialize new Node.js projects with package.json and basic configuration.
/**
* Initialize new Node.js project
* Creates package.json and basic project structure
*/
pnpm init [options]Options:
--yes, -y - Accept all defaults without prompting--scope <scope> - Initialize scoped package--private - Mark package as privateUsage Examples:
# Initialize new project interactively
pnpm init
# Initialize with defaults
pnpm init -y
# Initialize scoped package
pnpm init --scope @myorg
# Initialize private package
pnpm init --privateDiagnose pnpm installation and configuration issues.
/**
* Diagnose pnpm installation and configuration
* Checks for common issues and provides recommendations
*/
pnpm doctor [options]Usage Examples:
# Run full diagnostic check
pnpm doctor
# Check specific directory
pnpm doctor --dir /path/to/projectThe doctor command checks:
Install with Tessl CLI
npx tessl i tessl/npm-pnpm