Fast, reliable, and secure dependency management tool for JavaScript/Node.js projects
Commands for managing yarn configuration, global packages, and development symlinks.
Manage yarn configuration settings at global and project levels.
yarn config set <key> <value> [options] # Set configuration value
yarn config get <key> # Get configuration value
yarn config delete <key> [options] # Delete configuration key
yarn config list # List all configuration
yarn config current # Show current effective configuration
# Options:
--global, -g # Set global configuration (user-level)Usage Examples:
# Set configuration values
yarn config set registry https://registry.npmjs.org
yarn config set cache-folder /tmp/yarn-cache
yarn config set network-timeout 300000
# Set global configuration
yarn config set registry https://npm.company.com --global
yarn config set ignore-engines true --global
# Get configuration values
yarn config get registry
yarn config get cache-folder
# List all configuration
yarn config list
# Show current effective configuration with sources
yarn config current
# Delete configuration
yarn config delete registry
yarn config delete network-timeout --global# Registry settings
yarn config set registry <url> # Default package registry
yarn config set <scope>:registry <url> # Registry for scoped packages
# Cache settings
yarn config set cache-folder <path> # Cache directory location
yarn config set offline-mirror <path> # Offline cache location
# Network settings
yarn config set network-timeout <ms> # Network request timeout
yarn config set network-concurrency <number> # Concurrent network requests
# Installation behavior
yarn config set ignore-scripts <boolean> # Skip lifecycle scripts
yarn config set ignore-engines <boolean> # Ignore engines field
yarn config set ignore-platform <boolean> # Ignore platform checks
yarn config set flat <boolean> # Use flat dependency structure
# Workspace settings
yarn config set workspaces-experimental <boolean> # Enable workspace featuresConfiguration Examples:
# Corporate environment setup
yarn config set registry https://npm.company.com
yarn config set //npm.company.com/:_authToken ${NPM_TOKEN}
yarn config set strict-ssl false
# Development optimizations
yarn config set network-timeout 600000
yarn config set network-concurrency 16
yarn config set cache-folder ~/.yarn-cache
# Security settings
yarn config set ignore-scripts true
yarn config set audit-level moderateManage globally installed packages.
yarn global add <package> [options] # Install global package
yarn global remove <package> # Remove global package
yarn global list [options] # List global packages
yarn global upgrade [package] [options] # Upgrade global packages
yarn global bin # Show global bin directory
# Options for add:
--prefix <path> # Install to specific prefix
# Options for upgrade:
--latest # Upgrade to latest version (ignore semver)Usage Examples:
# Install global packages
yarn global add yarn
yarn global add @vue/cli
yarn global add create-react-app
yarn global add typescript
# Remove global packages
yarn global remove create-react-app
yarn global remove @vue/cli
# List global packages
yarn global list
yarn global list --depth=0
# Upgrade global packages
yarn global upgrade
yarn global upgrade typescript
# Upgrade to latest versions (ignoring semver)
yarn global upgrade --latest
yarn global upgrade typescript --latest
# Show global bin directory
yarn global bin
# Add global bin to PATH
export PATH="$(yarn global bin):$PATH"Global Package Location:
~/.config/yarn/global%LOCALAPPDATA%\Yarn\config\global$(yarn global bin) directoryCreate and manage symlinks for local development.
yarn link [package] # Link package from current directory
yarn unlink [package] # Unlink packageUsage Examples:
# In package directory - register for linking
cd /path/to/my-package
yarn link
# In consumer project - link to registered package
cd /path/to/my-project
yarn link my-package
# Unlink package
yarn unlink my-package
# In package directory - unregister from linking
cd /path/to/my-package
yarn unlinkLink Workflow:
yarn link in package directoryyarn link <package-name> in consumer projectyarn unlink <package-name> to restore normal dependencyLink Registry Location:
~/.config/yarn/link%LOCALAPPDATA%\Yarn\config\linkProject-level configuration file (.yarnrc):
# Registry configuration
registry "https://npm.company.com"
"@company:registry" "https://npm.company.com"
# Cache settings
cache-folder "/tmp/yarn-cache"
offline-mirror "./offline-cache"
# Network settings
network-timeout 300000
network-concurrency 8
# Installation settings
ignore-scripts true
ignore-engines false
flat false
# Authentication
"//npm.company.com/:_authToken" "${NPM_TOKEN}"Global configuration location:
~/.yarnrc%USERPROFILE%\.yarnrc# Global defaults
registry "https://registry.npmjs.org"
cache-folder "/Users/username/.yarn-cache"
disable-self-update-check true
ignore-engines trueYarn respects environment variables for configuration:
# Cache directory
YARN_CACHE_FOLDER=/path/to/cache
# Registry settings
YARN_REGISTRY=https://registry.npmjs.org
# Network settings
YARN_NETWORK_TIMEOUT=300000
YARN_NETWORK_CONCURRENCY=8
# Disable features
YARN_DISABLE_SELF_UPDATE_CHECK=true
YARN_ENABLE_OFFLINE_MODE=true
# Authentication
NPM_CONFIG_REGISTRY=https://npm.company.com
NPM_CONFIG__AUTH_TOKEN=${TOKEN}
# HTTP proxy
HTTP_PROXY=http://proxy.company.com:8080
HTTPS_PROXY=https://proxy.company.com:8080# Default registry
yarn config set registry https://registry.npmjs.org
# Scoped registries
yarn config set @company:registry https://npm.company.com
yarn config set @internal:registry https://internal-npm.company.com
# Authentication for each registry
yarn config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
yarn config set //npm.company.com/:_authToken ${COMPANY_TOKEN}# Token-based authentication
yarn config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
# Basic authentication (base64 encoded username:password)
yarn config set //npm.company.com/:_auth ${BASE64_AUTH}
# Username/password authentication
yarn config set //npm.company.com/:username ${USERNAME}
yarn config set //npm.company.com/:_password ${BASE64_PASSWORD}
yarn config set //npm.company.com/:email ${EMAIL}# Disable SSL verification (not recommended for production)
yarn config set strict-ssl false
# Custom CA certificate
yarn config set ca-file /path/to/ca-cert.pem
# Custom certificate files
yarn config set cert-file /path/to/client-cert.pem
yarn config set key-file /path/to/client-key.pem# Enable workspace features
yarn config set workspaces-experimental true
# Workspace-specific settings
yarn config set workspace-experimental true
yarn config set workspace-tools true# Cache settings
yarn config set cache-folder ~/.yarn-cache
yarn config set offline-mirror ./offline-packages
yarn config set disable-self-update-check true
# Cache cleanup
yarn config set cache-clean-interval 86400000 # 24 hours in ms# Network performance
yarn config set network-timeout 600000 # 10 minutes
yarn config set network-concurrency 16 # Concurrent requests
yarn config set child-concurrency 8 # Child processes
# Retry settings
yarn config set network-retry-count 3
yarn config set network-retry-delay 1000# Development optimizations
yarn config set save-prefix "~" # Use tilde for version ranges
yarn config set ignore-scripts false # Allow lifecycle scripts
yarn config set ignore-engines false # Check engine compatibility
yarn config set ignore-platform false # Check platform compatibility
# Workspace development
yarn config set link-duplicates true # Link duplicate packages
yarn config set link-folder ~/.config/yarn/link # Link registry locationYarn uses configuration in this priority order (highest to lowest):
--registry https://example.comYARN_REGISTRY=https://example.com./.yarnrc in project directory../.yarnrc (and up the directory tree)~/.yarnrc (user home directory)/etc/yarnrc (system-wide, Linux/macOS only)# Show effective configuration
yarn config list
# Show configuration sources
yarn config list --verbose
# Check specific configuration value
yarn config get registry
# Test configuration
yarn install --verbose # Shows which registry is being usedProject .yarnrc:
# Project-specific settings only
registry "https://npm.company.com"
"@company:registry" "https://npm.company.com"
network-timeout 300000Global .yarnrc:
# User preferences and defaults
cache-folder "/Users/username/.yarn-cache"
disable-self-update-check true
network-concurrency 8
save-prefix "^"Environment Variables (CI/CD):
# In CI/CD environment
export YARN_CACHE_FOLDER=/tmp/yarn-cache
export YARN_REGISTRY=https://npm.company.com
export YARN_DISABLE_SELF_UPDATE_CHECK=true
export NPM_CONFIG__AUTH_TOKEN=${NPM_TOKEN}Install with Tessl CLI
npx tessl i tessl/npm-yarn