coder/code-server · error · Error
`yarn` is no longer supported; please use `npm install` inst
Error message
`yarn` is no longer supported; please use `npm install` instead
What it means
code-server's preinstall lifecycle hook rejects yarn to enforce a single package manager (npm) and prevent lockfile/dependency drift. It inspects process.env.npm_execpath (the path to the running package manager binary) and aborts the install if the path contains 'yarn'. This keeps CI and contributor installs deterministic.
Source
Thrown at ci/dev/preinstall.js:2
if (process.env.npm_execpath.includes("yarn")) {
throw new Error("`yarn` is no longer supported; please use `npm install` instead")
}
View on GitHub (pinned to 51f90a376b)
Solutions
- Run `npm install` (or `npm ci` for reproducible installs) instead of `yarn`
- If a package-manager wrapper is forcing yarn, pin it to npm for this repo (e.g. `corepack enable && corepack use npm`) or uninstall the shim
- Remove any committed yarn.lock / .yarnrc.yml so tooling does not auto-detect yarn
Example fix
// before yarn install // after npm install
Defensive patterns
Strategy: validation
Validate before calling
// Run before invoking install in this repo
const execpath = process.env.npm_execpath || ""
if (execpath.includes("yarn")) {
console.error("This repo requires npm. Re-run with: npm install")
process.exit(1)
}
// Or detect the active manager up front:
const pkgManager = execpath.includes("yarn") ? "yarn"
: execpath.includes("pnpm") ? "pnpm" : "npm"
if (pkgManager !== "npm") throw new Error(`Use npm, not ${pkgManager}`) Prevention
- Document `npm install` as the only supported install command in CONTRIBUTING/README
- Do not commit a yarn.lock; tooling auto-detects yarn from its presence
- In CI, invoke `npm ci` explicitly rather than relying on a generic install step
When it happens
Trigger: Running `yarn` or `yarn install` in the code-server repo root, which invokes npm lifecycle scripts with npm_execpath pointing at the yarn binary. Also triggered by any wrapper (corepack, volta, asdf) that routes `install` through yarn.
Common situations: New contributors whose global default is yarn; monorepo tooling that auto-detects yarn from a stray yarn.lock; CI images that ship yarn as the default `install` command.
AI-assisted analysis of coder/code-server@51f90a376b (2026-08-12).
Data as JSON: /api/errors/2427a93400dccf8d.
Report an issue: GitHub.