# pnpm package.json5: What Works, What Breaks | JSON5.dev


Source: https://json5.dev/config/pnpm/

---

# JSON5 Manifests and pnpm

pnpm reads `package.json5` as a project manifest. Almost nothing else in the JavaScript toolchain does.

pnpm 12 still supports `package.json5` and `package.yaml`, keeps your comments when it edits the file, and publishes a normal `package.json` to the registry. We ran it to confirm each of those.

We also ran npm and both Yarn generations on the same file. The results explain why this feature stays a niche, and what to check before you adopt it.

![A package.json5 manifest read by a pnpm machine while npm and Yarn machines reject the same file](https://json5.dev/img/hero/config-pnpm.png)

**TL;DR:** pnpm's docs say it "also supports `package.json5` (in JSON5 format) and `package.yaml`". It still works in pnpm 12.23.0, comments survive edits, and `pnpm pack` emits a plain `package.json`. npm and Yarn do not read the file, and Renovate's default patterns do not list it. Use it only when every tool in your pipeline is pnpm. See also [Renovate and JSON5](https://json5.dev/config/renovate/).

[What pnpm Supports](#support) [Editing](#editing) [Publishing](#publishing) [Workspaces](#workspaces) [Other Tools](#other-tools) [Should You?](#should-you) [FAQ](#faq)

![pnpm logo](https://json5.dev/images/tech/pnpm.png)

## What pnpm Supports

The [package.json page](https://pnpm.io/package_json) of pnpm's documentation states it in one sentence: "pnpm also supports `package.json5` (in JSON5 format) and `package.yaml` (in YAML format)." We checked that this still holds in the newest release. npm lists pnpm 12.23.0 as the latest version on 11-29-2026, and we installed packages with it into a project that has only a `package.json5`.

The implementation is public. The `@pnpm/read-project-manifest` package (1001.2.6 when we read it) looks for a manifest in a fixed order and stops at the first file it finds:

Order

File

Parsed with

1

`package.json`

A strict JSON parser

2

`package.json5`

The `json5` npm package, version range `^2.2.3`

3

`package.yaml`

A YAML reader

So pnpm parses JSON5 manifests with the reference JavaScript implementation (see the [JavaScript guide](https://json5.dev/javascript/)). A parse failure is reported with the code `ERR_PNPM_JSON5_PARSE` and the file path. If none of the three files exists, the error reads "No package.json (or package.yaml, or package.json5) was found". Because `package.json` is tried first, a leftover `package.json` next to your `package.json5` silently wins.

Support is not a leftover. The 12.15.0 changelog lists fixes that name both formats: reporting linked package versions in linked projects that use them, and having self-update rewrite the pin in "`package.yaml` or `package.json5`". The 12.7.0 entry (published 09-25-2026) reads "pnpm now reads and updates `package.json5` project manifests. Manifest updates retain comments", and 12.8.0 adds that `pnpm add`, `pnpm version` and `pnpm pkg set` keep JSON5 style when they update the file. We cannot tell from those entries whether pnpm 11 or earlier already read the file, so we give no earlier version.

![Edit icon](https://json5.dev/images/icons/edit.png)

## Editing: Comments Survive

This is the one real advantage of a manifest in JSON5: you can explain a dependency choice next to the dependency. The risk is a tool rewriting the file and wiping the notes, so we tested it. Starting from this file:

`// Package manifest, hand-edited { name: 'demo-pkg', version: '1.0.0', // runtime deps dependencies: {}, files: ['index.js'], }`

we ran `pnpm add is-odd` with pnpm 12.23.0. The file afterwards:

`// Package manifest, hand-edited { name: 'demo-pkg', version: '1.0.0', // runtime deps dependencies: { 'is-odd': '^3.0.1' }, files: ['index.js'], }`

Both comments, the single quotes and the unquoted keys came through, and pnpm wrote its lockfile, `pnpm-lock.yaml`, beside the manifest. The source explains why: pnpm extracts the comments before it rewrites the file, serializes the data with `json5.stringify()`, then inserts the comments back. It also detects the original indentation and final newline.

Treat that as a good effort, not a guarantee. Comments are re-inserted by a text routine rather than attached to values, so a tool that moves or deletes a key may leave its comment somewhere unexpected. Review the diff after a bulk change, and see the [comments best practices](https://json5.dev/tutorials/comments-best-practices/) tutorial for comments that stay accurate.

**Not the `pnpm` key:** pnpm's docs say it "does not read settings from the `pnpm` field of `package.json`" and that settings belong in `pnpm-workspace.yaml`. That holds regardless of manifest format.

![Rocket icon](https://json5.dev/images/icons/rocket.png)

## Publishing: The Registry Gets JSON

npm packages carry a `package.json` inside the tarball, and every consumer reads that file. We ran `pnpm pack` in the project above and listed the tarball:

`package: demo-pkg@1.0.0 Tarball Contents index.js package.json`

No `package.json5` was shipped. The `package.json` inside was ordinary indented JSON, with quoted keys and the `files` list as an array. A `pnpm publish --dry-run` on the same project also worked and targeted the npm registry. So JSON5 is a source format for you; people who install your package never see it, and they need no JSON5 support at all.

That makes the checklist short. Run `pnpm pack` before the first release and open the generated `package.json`. Confirm that `main`, `exports`, `files` and `bin` are what you expect. Keep `package.json5` out of the `files` allow-list; it is not needed in the tarball, and pnpm did not include it in ours.

One caveat applies to the pipeline around publishing. The GitHub Action `pnpm/action-setup` reads the `packageManager` field to pick a pnpm version. A pull request teaching it to read `package.json5` (#191) was closed without merging on 11-03-2026, so do not assume the action reads a JSON5 manifest. Set the version explicitly in the workflow, or keep a `package.json` for CI.

![Layers icon](https://json5.dev/images/icons/layers.png)

## Workspaces and pnpm-workspace.yaml

A pnpm monorepo is declared in `pnpm-workspace.yaml`. That file is YAML only; the docs we read name no JSON5 variant. The packages it lists may use any of the three manifest names, and they can be mixed. We built a workspace with a root and one package using `package.json5`, plus a second package using `package.json` that depends on the first through `workspace:*`:

`# pnpm-workspace.yaml packages: - 'packages/*'`

`pnpm -r list --depth -1` found all three projects, and `pnpm install` finished with "Scope: all 3 workspace projects". Mixed workspaces therefore work. The cost is mental: people have to remember which package uses which format, and a script that reads manifests with `JSON.parse` will fail on the JSON5 ones. If you write such scripts, parse with the `json5` package instead, as pnpm does.

![Forbidden icon](https://json5.dev/images/icons/forbidden.png)

## What Does Not Read It

We put the same `package.json5` (one dependency, `is-odd` 3.0.1) in an empty folder and ran each tool on 11-29-2026.

Tool

Reads it

What happened

pnpm 12.23.0

![Yes](https://json5.dev/images/icons/yes.png)

Installed `is-odd` and wrote `pnpm-lock.yaml`

npm 11.6.4

![No](https://json5.dev/images/icons/no.png)

`npm install` failed with "Could not read package.json" (ENOENT)

Yarn 1.22.22

![No](https://json5.dev/images/icons/no.png)

Reported "success" but installed nothing: empty `node_modules` and an empty `yarn.lock`

Yarn 4.9.2

![No](https://json5.dev/images/icons/no.png)

"No project found"

Renovate npm manager

Not by default

Default file patterns are `package.json`, `pnpm-workspace.yaml` and `.yarnrc.yml`; `package.json5` is not mentioned

**Yarn 1 fails silently.** Its "success" message with an empty install is the dangerous case, because a CI job can go green with no dependencies installed. If a teammate might run Yarn 1 in this repo, they will not get an error.

We did not test Bun, Deno, Dependabot, bundlers or editor integrations, and make no claim about them. The general lesson is the one the [config guides](https://json5.dev/config/) repeat: JSON5 support is per tool, so list every program that opens the file and test each. Renovate users should read the [Renovate guide](https://json5.dev/config/renovate/), since a dependency bot that does not see your manifest will never open an update.

![Target icon](https://json5.dev/images/icons/target.png)

## Should You Use package.json5?

### Reasonable when

-   Every developer and CI job uses pnpm.
-   Nothing else parses the manifest: no bot, no script, no scanner.
-   You want comments beside dependencies and accept the review overhead.

### Avoid when

-   Contributors use npm or Yarn on the repository.
-   You rely on dependency bots that match `package.json`.
-   You maintain a library and want a repository other people can clone and run without a specific package manager.

For most projects, keep `package.json` and put the commentary somewhere else: a `README` section, or the `description` fields of a config file that does read JSON5. The settings that pnpm itself reads live in `pnpm-workspace.yaml`, which has real YAML comments. If you want JSON5 in a tool that fully supports it, the [Babel](https://json5.dev/config/babel/), [ESLint](https://json5.dev/config/eslint/) and [Prettier](https://json5.dev/config/prettier/) guides are better places to start.

## Staying on package.json

If the project cannot switch manifests, [comments in package.json](https://json5.dev/config/package-json/) covers what works in a plain `package.json` under npm, pnpm, Yarn and Bun, with the real error each one prints.

## pnpm and JSON5: Common Questions

### Does pnpm support `package.json5`?

Yes. The docs say so, and pnpm 12.23.0 installed packages into a project that had only that file.

### Does npm read it?

No. In npm 11.6.4, `npm install` failed with "Could not read package.json".

### Can I publish from it?

Yes. `pnpm pack` produced a tarball containing a plain `package.json`, and `pnpm publish --dry-run` succeeded.

### Are my comments kept when pnpm edits the file?

In our `pnpm add` test, yes. Comments are extracted and re-inserted, so review the diff after large changes.

### Which file wins if I have several?

pnpm tries `package.json`, then `package.json5`, then `package.yaml`, and uses the first it finds.

### Does `pnpm-workspace.yaml` have a JSON5 form?

Not that the pnpm docs describe. Workspace settings live in that YAML file.

## Related Pages

[![Renovate logo](https://json5.dev/images/tech/renovate.png)

### Renovate Config

renovate.json5 and the validator

](https://json5.dev/config/renovate/)[![Node.js logo](https://json5.dev/images/tech/nodejs.png)

### Node.js Guide

Parsing JSON5 in Node

](https://json5.dev/nodejs/)[![Settings icon](https://json5.dev/images/icons/settings.png)

### All Config Guides

Tools that read JSON5

](https://json5.dev/config/)

## Sources

(8)

1.  [pnpm docs: package.json](https://pnpm.io/package_json)
2.  [pnpm on npm (12.23.0)](https://www.npmjs.com/package/pnpm)
3.  [@pnpm/read-project-manifest on npm (1001.2.6, source read from the published package)](https://www.npmjs.com/package/@pnpm/read-project-manifest)
4.  [@pnpm/write-project-manifest on npm (1000.0.16, source read from the published package)](https://www.npmjs.com/package/@pnpm/write-project-manifest)
5.  [pnpm 12.15.0 changelog](https://unpkg.com/pnpm@12.15.0/CHANGELOG.md)
6.  [pnpm/action-setup pull request 191: package.json5 support (closed unmerged)](https://github.com/pnpm/action-setup/pull/191)
7.  [Renovate docs: npm manager](https://docs.renovatebot.com/modules/manager/npm/)
8.  [json5 on npm](https://www.npmjs.com/package/json5)

Last reviewed: November 29, 2026.
