How to fix npm ERR! code E406 npm ERR! 406 Not Acceptable in npm

npmINTERMEDIATEHIGHUpdated Dec 5, 2025ยท 144 views

The npm E406 error occurs when the npm registry server rejects your request due to incompatible Accept headers or misconfigured registry settings. This commonly happens with custom registries like Artifactory, Nexus, or private repositories.

Quick fix

Fixes npm ERR! code E406 npm ERR! 406 Not Acceptable

npm config get registry
  1. Verify your current registry configuration
  2. Validate the registry URL format
  3. Clear npm cache and retry
  4. Reset to default registry and test
npm โ€” error
npm config get registry
npm ERR! code E406
npm ERR! 406 Not Acceptable

What this error means

HTTP 406 Not Acceptable is a client error response that indicates the server has received your request and the resource exists, but it cannot provide a response matching the content type your npm client is requesting. This typically happens when: 1. Your npm client sends an Accept header (like `application/vnd.npm.install-v1+json`) that the registry server doesn't understand or support. 2. The registry is a private repository (Artifactory, Nexus, etc.) that doesn't fully implement the npm registry specification. 3. The registry URL path is incorrect, preventing proper content type negotiation. The 406 error is essentially a communication mismatch between your npm client and the remote package server.

Typical symptoms

  • npm install, npm update, or npm ci fails with 'ERR! code E406'
  • Error occurs specifically when using a custom or private npm registry
  • Command works fine with the default npmjs.org registry but fails with your configured registry
  • Installing from GitHub or GitLab repositories results in 406 errors
  • Error message includes 'fetch failed with status code 406' or '406 Not Acceptable'

Common causes

  1. Custom registry (Artifactory, Nexus, GitLab, etc.) doesn't support the Accept headers npm sends
  2. Registry URL is incorrectly configured - missing API path or using wrong protocol
  3. Private registry doesn't fully implement npm registry specification and fails content negotiation
  4. Older versions of Nexus (2.x) lack support for scoped packages like @types/node
  5. Proxy or firewall between client and registry modifies or blocks npm's Accept headers

How to fix "npm ERR! code E406 npm ERR! 406 Not Acceptable"

1Verify your current registry configuration

First, check which registry npm is currently configured to use:

bash
npm config get registry

If you see a custom registry URL (not https://registry.npmjs.org/), that's likely where the issue is. Take note of the full URL for the next steps.

2Validate the registry URL format

Ensure your registry URL follows the correct format:

For Artifactory:

bash
npm config set registry https://artifacts.company.com/artifactory/api/npm/npm-remote/

For Nexus 3:

bash
npm config set registry https://nexus.company.com/repository/npm/

For GitLab:

bash
npm config set registry https://gitlab.company.com/api/v4/packages/npm/

The key is including the /api/ or /repository/ path that points to the npm proxy/repository.

3Clear npm cache and retry

Clear any cached data that might be causing issues:

bash
npm cache clean --force

Then attempt your install again:

bash
npm install

This removes stale cache entries that might be interfering with content negotiation.

4Reset to default registry and test

Temporarily switch to the official npm registry to isolate the problem:

bash
npm config set registry https://registry.npmjs.org/
npm install

If this succeeds, the issue is with your custom registry configuration. If it fails, the problem is elsewhere (network, authentication, etc.). Once confirmed, switch back to your custom registry and check the URL format from Step 2.

5Fix protocol or authentication issues

For GitHub dependencies in package.json, use the git:// protocol instead of https://:

json
{
  "dependencies": {
    "my-package": "git://github.com/user/repo.git#branch-name"
  }
}

For private registries requiring authentication, ensure your .npmrc has the correct credentials:

bash
npm login --registry=https://artifacts.company.com/artifactory/api/npm/npm-remote/

Or add to .npmrc:

bash
@myorg:registry=https://artifacts.company.com/artifactory/api/npm/npm-remote/
//artifacts.company.com/artifactory/api/npm/npm-remote/:_authToken=YOUR_TOKEN_HERE

Advanced notes

If you're running Nexus 2.x with scoped packages (@myorg/package), upgrade to Nexus 3.x which has full npm scoped package support. For Artifactory users, ensure you're pointing to the correct repository path that proxies npmjs.org. Some older private registries may not correctly implement the npm Accept header specification (application/vnd.npm.install-v1+json); in these cases, contact your registry administrator for an update or configuration adjustment. Use npm install --verbose to see exact headers being sent and responses received.

Frequently asked questions

What does "npm ERR! code E406 npm ERR! 406 Not Acceptable" mean?
HTTP 406 Not Acceptable is a client error response that indicates the server has received your request and the resource exists, but it cannot provide a response matching the content type your npm client is requesting. This typically happens when: 1. install-v1+json) that the registry server doesn't understand or support.
How do I fix "npm ERR! code E406 npm ERR! 406 Not Acceptable"?
The npm E406 error occurs when the npm registry server rejects your request due to incompatible Accept headers or misconfigured registry settings. This commonly happens with custom registries like Artifactory, Nexus, or private repositories.
What causes "npm ERR! code E406 npm ERR! 406 Not Acceptable"?
Custom registry (Artifactory, Nexus, GitLab, etc.) doesn't support the Accept headers npm sends Registry URL is incorrectly configured - missing API path or using wrong protocol Private registry doesn't fully implement npm registry specification and fails content negotiation
Is the "npm ERR! code E406 npm ERR! 406 Not Acceptable" 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