Skip to content

pnpm self-upgrade fails with ERR_PNPM_NO_PKG_MANIFEST when run outside a project directory #12240

Description

@kht2199

Verify latest release

  • I verified that the issue exists in the latest pnpm release

pnpm version

11.5.2

Which area(s) of pnpm are affected? (leave empty if unsure)

self-upgrade

Reproduction steps

  1. Open a terminal in any directory that does not have a package.json (e.g. the user's home directory ~)
  2. Run pnpm self-upgrade

Describe the Bug

pnpm self-upgrade fails with ERR_PNPM_NO_PKG_MANIFEST when executed from a directory that does not contain a package.json.

[ERR_PNPM_NO_PKG_MANIFEST] No package.json found in /Users/htkim
[ERROR] Command failed with exit code 1: node .../pnpm.mjs install

Looking at the stack trace, self-upgrade internally triggers runDepsStatusCheck, which calls pnpm install in the current working directory. Since there is no package.json in the home directory, it fails.

at runDepsStatusCheck (pnpm.mjs:220133)
  at runPnpmCli (pnpm.mjs:218401)
  at spawnSubprocessSync (pnpm.mjs:38200)

self-upgrade should not require a package.json in the current directory — it is upgrading the pnpm binary itself, not a project's dependencies.

Workaround

Use npm install -g pnpm@latest instead.

Expected Behavior

pnpm self-upgrade completes successfully regardless of the current working directory.

Which Node.js version are you using?

v22.17.1

Which operating systems have you used?

  • macOS
  • Windows
  • Linux

If your OS is a Linux based, which one it is? (Include the version if relevant)

macOS 26.4.1 (Darwin 25.4.0)

Related issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions