/errors/pnpm/err-pnpm-no-lockfile
ERR_PNPM_NO_LOCKFILE Cannot install with "frozen-lockfile" because pnpm-lock.yaml is absent
verified onenvironmentlocal · windows 10.0.26200 arm64 · GNU bash 5.3.15 (Git Bash)updated
- tool
- pnpm
- exit code
- 1
- versions
- pnpm 8 – 10
- os
- any
ERR_PNPM_NO_LOCKFILE Cannot install with "frozen-lockfile" because pnpm-lock.yaml is absent means pnpm install ran in frozen-lockfile mode (the default in CI) and there is no pnpm-lock.yaml. In this mode pnpm installs exactly what the lockfile says and refuses to create or change it. Run pnpm install on your machine and commit the generated pnpm-lock.yaml.
Reproduce it
cat > package.json <<'EOF'
{ "name": "app", "version": "1.0.0", "dependencies": { "is-number": "7.0.0" } }
EOF
npx --yes pnpm@9 install --frozen-lockfileOutput · exit 1
ERR_PNPM_NO_LOCKFILE Cannot install with "frozen-lockfile" because pnpm-lock.yaml is absent Note that in CI environments this setting is true by default. If you still need to run install in such cases, use "pnpm install --no-frozen-lockfile"
pnpm detects CI through environment variables such as CI=true, which GitHub Actions, GitLab CI and most other systems set. There, plain pnpm install behaves like pnpm install --frozen-lockfile.
Fix
pnpm install # creates pnpm-lock.yaml
git add pnpm-lock.yaml
git commit -m "Add pnpm lockfile"Coming from npm or Yarn, pnpm import builds pnpm-lock.yaml from package-lock.json or yarn.lock, keeping the same resolved versions.
Related errors
| Error | Meaning |
|---|---|
| ERR_PNPM_NO_LOCKFILE | No pnpm-lock.yaml at all |
| ERR_PNPM_OUTDATED_LOCKFILE | The lockfile exists but does not match package.json (a dependency was added or changed without re-running pnpm install) |
| ERR_PNPM_LOCKFILE_CONFIG_MISMATCH | The lockfile was created with different settings, for example overrides or patched dependencies |
Sources
Related pages
flags · yarnyarn install --frozen-lockfile (Yarn 1) and --immutable (Yarn 2+)yarn install --frozen-lockfile fails instead of updating yarn.lock when it is out of date; Yarn 2+ uses --immutable. Real errors and the lockfile fix.compare · npmnpm ci vs npm install: differences and when to use eachnpm ci installs exactly what package-lock.json says, deletes node_modules first and never edits the lockfile; npm install resolves ranges and may update it.errors · npmnpm ERR! code ERESOLVE: unable to resolve dependency treenpm fails with ERESOLVE when a package's peer dependency conflicts with the version you install. Read Found and Could not resolve, then align the versions.errors · pnpmERR_PNPM_OUTDATED_LOCKFILE Cannot install with "frozen-lockfile" because pnpm-lock.yaml is not up to dateERR_PNPM_OUTDATED_LOCKFILE means package.json changed but pnpm-lock.yaml was not regenerated, and CI installs with frozen-lockfile. Run pnpm install and commit.