Use npm with Pier
Pier’s registry tracks the npm registry HTTP spec end-to-end, so every npm release from 7 through 11 works against it without bespoke flags.
Configure
Section titled “Configure”.npmrc in your project root (or ~/.npmrc for a global default):
registry=https://YOUR-PIER-HOST/registry/npm///YOUR-PIER-HOST/registry/npm/:_authToken=pier_npm_…always-auth=truealways-auth=true is harmless on npm 7+ and required for yarn 1 — keep it so the .npmrc works for both clients.
Install
Section titled “Install”# Public package — proxied from npmjs.org if upstream proxy is onnpm install left-pad
# Private packagenpm install @your-org/internal-lib
# Specific dist-tagnpm install @your-org/internal-lib@betaPublish
Section titled “Publish”# package.json carries the versionnpm publish
# Or pin the target without touching .npmrcnpm publish --registry=https://YOUR-PIER-HOST/registry/npm/Login (browser flow)
Section titled “Login (browser flow)”npm login --auth-type=web --registry=https://YOUR-PIER-HOST/registry/npm/# → opens browser, authenticate in Pier panel (with 2FA)# → pier_npm_… token written to .npmrc automaticallyThe legacy npm login (without --auth-type=web) uses the CouchDB user creation flow — also supported. The web flow inherits 2FA from the panel; the CouchDB flow does not prompt for OTP. If you require 2FA on every token mint, disable CouchDB login in panel settings.
Dist-tags
Section titled “Dist-tags”npm dist-tag ls @your-org/libnpm dist-tag rm @your-org/lib betaDeprecate
Section titled “Deprecate”Unpublish
Section titled “Unpublish”npm unpublish @your-org/lib --force # whole packageVersions matrix
Section titled “Versions matrix”| npm version | Status | Notes |
|---|---|---|
| 7 | ✓ | Works out of the box |
| 8 | ✓ | Works out of the box |
| 9 | ✓ | Works out of the box |
| 10 | ✓ | Works out of the box |
| 11 | ✓ | always-auth config warning is harmless |
Common errors
Section titled “Common errors”401 Unauthorizedon install — token missing oralways-auth=trueabsent from.npmrc. See Troubleshooting.409 Conflicton publish — version already exists. Bump inpackage.json.npm warn Unknown project config "always-auth"on npm 11 — flag is deprecated but still honored. You can ignore the warning.
Related
Section titled “Related”- Setup — initial configuration walkthrough.
- Publish — full publish workflow.
- CI integration — npm in GitHub Actions and GitLab CI.