PACKAGE_MANAGER variable.
Auto-Detection
WhenPACKAGE_MANAGER is set to auto (the default), the egg inspects your project’s lockfile at startup to decide which manager to use:
| Lockfile present | Manager selected |
|---|---|
pnpm-lock.yaml | pnpm |
yarn.lock | yarn |
| Neither | npm |
pnpm takes priority over yarn in the detection order. If your repository contains both
pnpm-lock.yaml and yarn.lock for any reason, the egg will select pnpm.Overriding the Package Manager
SetPACKAGE_MANAGER to npm, pnpm, or yarn to force a specific manager regardless of which lockfiles are present. This is useful when:
- Your lockfile is absent from the repository (e.g. it is in
.gitignore) - You want to enforce a consistent manager across environments
- Auto-detection is picking the wrong manager
Install Behavior by Manager
- npm
- pnpm
- yarn
The egg checks whether
package-lock.json exists in your project root:- Lockfile present — runs
npm ci, which installs exactly the versions recorded inpackage-lock.json. This is deterministic and will fail if the lockfile is out of sync withpackage.json. - No lockfile — runs
npm install, which resolves dependencies frompackage.jsonand generates a fresh lockfile.
Deterministic Installs
All three managers use a frozen or clean install mode when a lockfile is present, which means:- Dependencies never silently upgrade between server restarts.
- If a dependency is added to
package.jsonbut the lockfile is not updated, the install will fail loudly rather than silently installing an unexpected version.
AUTO_UPDATE=1) or on the next manual restart after you push.