How to fix npm ERR! code E404 npm ERR! 404 Not Found - PUT https://registry.npmjs.org/package - Package not found in npm

npmINTERMEDIATEHIGHUpdated Dec 5, 2025· 96 views

The npm E404 'PUT 404 Not Found' error occurs when attempting to publish a package to npm or a private registry. This error indicates authentication issues, organization/scope misconfigurations, or registry pointing to the wrong location.

Quick fix

Fixes npm ERR! code E404 npm ERR! 404 Not Found - PUT https://registry.npmjs.org/package - Package not found

npm whoami
  1. Verify you are logged in
  2. Verify your email address on npmjs.com
  3. For scoped packages, verify organization membership
  4. Use --access public for scoped packages
npm — error
npm whoami
npm ERR! code E404
npm ERR! 404 Not Found - PUT https://registry.npmjs.org/package - Package not found

What this error means

When you run 'npm publish', npm sends a PUT request to the registry to create or update a package. The 404 'Not Found' error means the registry could not locate or authenticate to the destination where your package should be published. This is NOT a 'package not found' error in the traditional sense—it's a routing, authentication, or permission failure at the registry level. The error message is misleading because npm conflates 'authentication failed' and 'package location not found' into a single 404 response. Common causes include not being logged in, scope/organization mismatches, or publishing scoped packages without proper access configuration.

Typical symptoms

  • npm publish command fails with 'code E404' before attempting to upload
  • Error occurs at the start of publish, not during file upload
  • Running 'npm whoami' shows you're logged in, but publish still fails
  • Works locally but fails in CI/CD pipelines
  • Publishing unscoped packages works, but scoped packages fail
  • Error appears after enabling two-factor authentication (2FA)

Common causes

  1. Not logged in or authentication token is invalid/expired
  2. Scope mismatch: package is scoped (@org/name) but you're not a member of that organization
  3. Organization does not exist on npmjs.com
  4. Publishing a scoped package without --access public flag (requires paid account for private)
  5. Two-factor authentication enabled but old token still in use
  6. Registry misconfiguration in .npmrc pointing to wrong location
  7. Email address not verified on npmjs.com account

How to fix "npm ERR! code E404 npm ERR! 404 Not Found - PUT https://registry.npmjs.org/package - Package not found"

1Verify you are logged in

Confirm your npm authentication status:

bash
npm whoami

If this returns your username, you are logged in. If it says 'not logged in', run:

bash
npm logout
npm login
2Verify your email address on npmjs.com

Even if you're logged in via CLI, npm requires a verified email for publishing. Go to https://www.npmjs.com/settings/profile and confirm your email address is marked as verified.

3For scoped packages, verify organization membership

If your package name includes a scope (e.g., @myorg/mypackage), you must be a member of that organization on npmjs.com:

1. Visit https://www.npmjs.com/org/create
2. Check if the organization exists and if your username is a member
3. If the scope doesn't exist, create it or change your package name
4. After being added, run npm logout && npm login to refresh your auth token

4Use --access public for scoped packages

Scoped packages are private by default. If you don't have a paid npm account, publish with:

bash
npm publish --access public

Add this flag to your CI/CD publish command as well.

5Check package.json name and scope

Open your package.json and verify the name:

json
{
  "name": "@myusername/my-package",
  "version": "1.0.0"
}

- For npmjs.org: scope must match your npm username or an org you belong to
- For GitHub Packages: scope must match your GitHub username or org

6Verify registry configuration in .npmrc

Check your .npmrc file:

bash
cat ~/.npmrc

For default npmjs.org publishing, it should contain:

bash
registry=https://registry.npmjs.org/
//registry.npmjs.org/:_authToken=your_token_here
7For CI/CD, regenerate automation tokens

If publishing from GitHub Actions or other CI:

1. Visit https://www.npmjs.com/settings/tokens
2. Generate a new Automation token (not 'Read and Publish')
3. Update your CI/CD secret (e.g., NPM_TOKEN)
4. If you enabled 2FA, you MUST use an Automation token

Advanced notes

Why npm returns 404 instead of 401: npm's registry returns 404 for authentication failures in some cases instead of 401 Unauthorized. This is a design flaw that makes troubleshooting difficult.

Automation tokens for CI/CD: When publishing from CI/CD, regular npm passwords don't work. You must generate an 'Automation' token which works without prompting for 2FA.

Registry-specific auth: Different registries require different authentication mechanisms. npmjs.org uses Bearer tokens, GitHub Packages requires a personal access token, and Artifactory/Nexus have their own credential systems.

Unpublish embargo: After unpublishing a version, that exact version+name combination is locked for 72 hours. You cannot republish it even with new auth.

Frequently asked questions

What does "npm ERR! code E404 npm ERR! 404 Not Found - PUT https://registry.npmjs" mean?
When you run 'npm publish', npm sends a PUT request to the registry to create or update a package. The 404 'Not Found' error means the registry could not locate or authenticate to the destination where your package should be published. This is NOT a 'package not found' error in the traditional sense—it's a routing, authentication, or permission failure at the registry level.
How do I fix "npm ERR! code E404 npm ERR! 404 Not Found - PUT https://registry.npmjs"?
The npm E404 'PUT 404 Not Found' error occurs when attempting to publish a package to npm or a private registry. This error indicates authentication issues, organization/scope misconfigurations, or registry pointing to the wrong location.
What causes "npm ERR! code E404 npm ERR! 404 Not Found - PUT https://registry.npmjs"?
Not logged in or authentication token is invalid/expired Scope mismatch: package is scoped (@org/name) but you're not a member of that organization Organization does not exist on npmjs.com
Is the "npm ERR! code E404 npm ERR! 404 Not Found - PUT https://registry.npmjs" error serious?
Yes. This is a high-severity error that usually blocks work until it is fixed, but the steps above resolve it.

Official resources & further reading