Skip to content

Use pnpm with Pier

pnpm reads its registry config from .npmrc — the same file npm uses. Authentication semantics match npm (bearer on every request), so unlike yarn 1 you don’t need always-auth=true for pnpm to work.

.npmrc
registry=https://YOUR-PIER-HOST/registry/npm/
//YOUR-PIER-HOST/registry/npm/:_authToken=pier_npm_…
always-auth=true

always-auth=true is optional for pnpm — it’s harmless and recommended if you also use yarn 1 in the same project.

Terminal window
pnpm install
pnpm add left-pad
pnpm add @your-org/internal-lib
pnpm add -D typescript # devDependency
Terminal window
pnpm publish
pnpm publish --tag beta
pnpm publish --no-git-checks # skip the clean-tree check in CI

For a pnpm workspace, put .npmrc at the workspace root — every package inherits it. No need to duplicate per package.

my-monorepo/
├── .npmrc ← here
├── package.json
├── pnpm-workspace.yaml
└── packages/
├── app/package.json
└── lib/package.json

If a single package needs a different registry, drop a .npmrc next to its package.json — pnpm uses the closest one walking up.

When you list node_modules/ after a pnpm install, you’ll see node_modules/.pnpm/ containing the actual content-addressed store. Top-level deps are symlinks into it. This is intentional and doesn’t affect Pier — packages are still requested through the same HTTP API.

pnpm version Status Notes
9 ✓ Works out of the box
10 ✓ Works out of the box

Pin via packageManager in package.json so corepack uses the right version:

{
"packageManager": "[email protected]"
}
  • ERR_PNPM_FETCH_401 — token revoked or missing. Mint a fresh one in Packages → Manage tokens.
  • ERR_PNPM_FETCH_404 — upstream proxy off + package not privately published. Toggle it on in Packages → Upstream proxy.
  • ERR_PNPM_INTEGRITY_CHECK_FAILED — Pier-stored tarball got out of sync with its sha512. Rare; typically caused by manual FS edits. Solution: rm /opt/pier/data/registry/<pkg>/<file>.tgz and re-install (Pier will re-fetch with correct integrity).