Fast, reliable, and secure dependency management tool for JavaScript/Node.js projects
Commands for inspecting packages, dependencies, and project status to understand your project's dependency tree and package details.
Show detailed information about packages from the registry.
yarn info <package> [field] [options]
# Options:
--json # Output in JSON format
--registry <url> # Use specific registryUsage Examples:
# Show all package information
yarn info react
# Show specific field
yarn info react version
yarn info react description
yarn info react dependencies
yarn info react peerDependencies
# Show information in JSON format
yarn info react --json
# Show information from specific registry
yarn info react --registry https://registry.npmjs.org
# Show information for scoped package
yarn info @types/react
# Show information for specific version
yarn info react@17.0.2Available Fields:
name - Package nameversion - Latest versiondescription - Package descriptionkeywords - Package keywordshomepage - Homepage URLrepository - Repository informationauthor - Author informationlicense - License informationdependencies - Production dependenciesdevDependencies - Development dependenciespeerDependencies - Peer dependenciesengines - Node.js/npm version requirementsscripts - Available scriptsdist - Distribution informationmaintainers - Package maintainersDisplay the dependency tree of installed packages.
yarn list [pattern] [options]
# Options:
--depth <number> # Limit dependency depth (default: all levels)
--pattern <pattern> # Filter packages by pattern
--json # Output in JSON formatUsage Examples:
# List all dependencies
yarn list
# List with limited depth
yarn list --depth=0 # Only direct dependencies
yarn list --depth=1 # Direct + one level deep
# Filter by pattern
yarn list --pattern "react*"
yarn list --pattern "@types/*"
# List in JSON format
yarn list --json
# List specific package and its dependencies
yarn list reactOutput Format:
├─ package-a@1.0.0
│ ├─ dependency-1@2.0.0
│ └─ dependency-2@3.0.0
├─ package-b@2.0.0
└─ package-c@1.5.0
└─ shared-dep@1.0.0Explain why a package is installed and show the dependency chain.
yarn why <package>Usage Examples:
# Show why package is installed
yarn why lodash
# Show why specific version is installed
yarn why lodash@4.17.21
# Show why scoped package is installed
yarn why @babel/coreOutput Example:
info Reasons this module exists
- "eslint-config-airbnb" depends on it
- Hoisted from "eslint-config-airbnb#lodash"
- "webpack#uglifyjs-webpack-plugin" depends on it
- Hoisted from "webpack#uglifyjs-webpack-plugin#lodash"Display packages that have newer versions available.
yarn outdated [package] [options]
# Options:
--json # Output in JSON formatUsage Examples:
# Show all outdated packages
yarn outdated
# Check specific package
yarn outdated react
# Output in JSON format
yarn outdated --jsonOutput Format:
Package Current Wanted Latest Package Type
react 16.8.0 16.14.0 18.2.0 dependencies
@types/node 14.18.0 14.18.63 20.5.0 devDependenciesShow license information for installed packages.
yarn licenses list # List all licenses
yarn licenses generate-disclaimer # Generate license disclaimer textUsage Examples:
# List all package licenses
yarn licenses list
# Generate disclaimer text for legal compliance
yarn licenses generate-disclaimer > LICENSES.txtList Output:
├─ MIT
│ ├─ react@18.2.0
│ ├─ lodash@4.17.21
│ └─ express@4.18.2
├─ Apache-2.0
│ └─ @babel/core@7.22.0
└─ BSD-3-Clause
└─ qs@6.11.0Show the location of package binaries.
yarn bin [package]Usage Examples:
# Show bin directory path
yarn bin
# Show path to specific binary
yarn bin eslint
yarn bin @babel/cli
# Common usage in scripts
export PATH="$(yarn bin):$PATH"Output:
.bin directory path# Show dependency tree for specific package
yarn list --pattern "react*" --depth=2
# Find all packages depending on a specific package
yarn why lodash | grep "depends on it"
# Check for duplicate dependencies
yarn list --pattern "*" | grep -E "^\s+├─|^\s+└─" | sort | uniq -d# Check what version would be installed
yarn info react@^17.0.0 version
# Compare current vs available versions
yarn outdated | grep "^react "
# Check if package satisfies semver range
yarn info react versions --json | jq '.data[] | select(test("^17\\."))'# Check package from different registry
yarn info react --registry https://registry.npmjs.org
# Show package download statistics (if supported by registry)
yarn info react dist
# Show package maintainers
yarn info react maintainers# List packages in workspace
yarn workspaces info
# Show workspace dependency tree
yarn workspaces info --json
# Check why package is installed in workspace context
yarn workspace my-package why lodashMost information commands support --json flag for programmatic usage:
# Package info as JSON
yarn info react --json | jq '.data.version'
# List as JSON
yarn list --json | jq '.data.trees[].name'
# Outdated as JSON
yarn outdated --json | jq '.data.body[] | select(.current != .latest)'
# Workspaces as JSON
yarn workspaces info --json | jq 'keys[]'# Check for security vulnerabilities
yarn audit --json | jq '.data.vulnerabilities'
# Verify no packages are outdated in CI
yarn outdated --json | jq '.data.body | length' | xargs test 0 -eq
# Generate license report for compliance
yarn licenses generate-disclaimer > build/THIRD_PARTY_LICENSES.txt# Quick dependency health check
yarn outdated && yarn audit
# Show package sizes (with additional tooling)
yarn list --json | jq -r '.data.trees[] | "\(.name)@\(.version)"' | xargs npm-check-size
# Find unused dependencies (with additional tooling)
npx depcheck --ignore-patterns="build/**"Install with Tessl CLI
npx tessl i tessl/npm-yarn