npm ERR! code E402 — 402 Payment Required - PUT https://registry.npmjs.org/@scope%2fpkg - You must sign up for private packages
You published a scoped package without --access public, so npm tried to publish it as private.
Seen on:
npm
Meaning
Scoped packages default to restricted (private) access, which requires a paid plan.
Common causes
- First publish of a @scope package without --access public
- publishConfig.access set to restricted
⚡ Quick fix
- npm publish --access public
- Or set "publishConfig": { "access": "public" }
Detailed fix by platform
npm
"publishConfig": { "access": "public" }
How to diagnose
- Scope — Scoped package?
- Access — public set?
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026