E402 npm Origin: Build & delivery Last updated 13 Oct 2026

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.

Exact message you may see 402 Payment RequiredYou must sign up for private packages
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

  1. npm publish --access public
  2. Or set "publishConfig": { "access": "public" }

Detailed fix by platform

npm

  1. "publishConfig": { "access": "public" }

How to diagnose

  1. Scope — Scoped package?
  2. Access — public set?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Build & delivery. Errors that are often confused with or caused by this one (click to open):

cb() never called — npm ERR! cb() never called! (npm)cb() never calledCorepack keyid — Error: Cannot find matching keyid (Corepack signature verification) (npm)Corepack keyidE401 — npm ERR! code E401 — Unable to authenticate, need: Basic realm / Incorrect or missing password (npm)E401E403 — npm ERR! code E403 — 403 Forbidden - PUT https://registry.npmjs.org/x - You do not have permission to publish (npm)E403EEXIST — npm ERR! code EEXIST — EEXIST: file already exists, symlink '../lib/node_modules/x/bin/x' -> '/usr/local/bin/x' (npm)EEXISTENEEDAUTH — npm ERR! code ENEEDAUTH — need auth This command requires you to be logged in (npm)ENEEDAUTHENOSPC — Error: ENOSPC: System limit for number of file watchers reached (npm)ENOSPCEOTP — npm ERR! code EOTP — This operation requires a one-time password from your authenticator (npm)EOTPE402

Explore the map of this error Full error map →

🧠 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.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.