Skip to content

/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

bash
cat > package.json <<'EOF'
{ "name": "app", "version": "1.0.0", "dependencies": { "is-number": "7.0.0" } }
EOF
npx --yes pnpm@9 install --frozen-lockfile

Output · 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

bash
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.

ErrorMeaning
ERR_PNPM_NO_LOCKFILENo pnpm-lock.yaml at all
ERR_PNPM_OUTDATED_LOCKFILEThe lockfile exists but does not match package.json (a dependency was added or changed without re-running pnpm install)
ERR_PNPM_LOCKFILE_CONFIG_MISMATCHThe lockfile was created with different settings, for example overrides or patched dependencies

Sources