corepack
Node.js package manager manager
TLDR
Enable Corepack
SYNOPSIS
corepack command [arguments]
DESCRIPTION
corepack is Node.js's package manager manager. It transparently manages Yarn, npm, and pnpm versions per project, using the "packageManager" field in package.json. This ensures that each project uses its specified package manager version without requiring global installations or manual version switching.
Included with Node.js from version 14.19.0 to 24.x, Corepack acts as a shim that intercepts package manager commands and automatically downloads and uses the correct version specified in the project's configuration. This eliminates "works on my machine" issues caused by package manager version mismatches across development teams.
The tool maintains a local cache of package manager versions and can operate in offline mode using packed archives. Zero runtime dependencies make it lightweight and reliable for CI/CD environments.
PARAMETERS
--activate
Set as default after preparing
COMMANDS
enable
Install shims for package managers in PATHdisable
Remove shims, restore direct accessprepare
Download and cache package manager versionuse
Update package.json with packageManager fieldhydrate
Install package manager from archivepack
Create archive for offline installation
PACKAGE.JSON INTEGRATION
"packageManager": "pnpm@9.0.0"
}
ENVIRONMENT
COREPACK_HOME
Cache directory for package managersCOREPACK_ENABLE_DOWNLOAD_PROMPT
Prompt before downloadingCOREPACK_ENV_FILE
Custom env file path (set to 0 to disable)
OFFLINE USAGE
corepack hydrate ./yarn.tgz # Install from archive
CAVEATS
Must be enabled before use. Respects packageManager in nearest package.json. Zero runtime dependencies.
