Skip to content

/errors/pnpm/err-pnpm-no-pkg-manifest

ERR_PNPM_NO_PKG_MANIFEST No package.json found in ...

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_PKG_MANIFEST No package.json found in /path means pnpm looked for a project manifest (package.json, package.yaml or package.json5) in the current directory and found none. Change into the project folder that contains package.json and run the command again, or create a manifest with pnpm init if this is a new project.

Reproduce it

bash
mkdir empty && cd empty
npx --yes pnpm@9 install

Output · exit 1

 ERR_PNPM_NO_PKG_MANIFEST  No package.json found in /tmp/work/empty

Fix

bash
mkdir -p app && cd app
npx --yes pnpm@9 init > /dev/null
ls
cd ..
npx --yes pnpm@9 --dir app install > /dev/null 2>&1
echo "install exit=$?"

Output

package.json
install exit=0

pnpm --dir PATH (short -C PATH) runs pnpm as if it had been started in PATH, which is handy in CI scripts.

In CI and Docker

EnvironmentWhat to check
GitHub Actionsdefaults.run.working-directory or working-directory on the step points to the folder with package.json
GitLab CIcd into the project subfolder in script, or set the job to run there
DockerWORKDIR /app, then COPY package.json pnpm-lock.yaml ./ before RUN pnpm install
MonorepoRun pnpm install from the workspace root (where pnpm-workspace.yaml is)

npm prints the same situation as ENOENT: no such file or directory, open '.../package.json'.

Sources