The ENEEDAUTH error occurs when npm cannot authenticate with the registry. Run npm login to authenticate, or check your .npmrc for missing or expired tokens.
The ENEEDAUTH error indicates npm cannot find valid authentication credentials for the registry you're trying to access. This commonly occurs when publishing packages, installing from private registries, or accessing scoped packages. Even if you've logged in before, tokens can expire, .npmrc configuration can be incorrect, or you might be logged into the wrong registry.
Authenticate with the registry:
# Log in to npm public registry
npm login
# Log in to specific registry
npm login --registry=https://your-registry.com
# For npm 9+ with private registries
npm login --auth-type=legacy --registry=https://your-registry.comCheck if you're authenticated:
# Check who you're logged in as
npm whoami
# Check for specific registry
npm whoami --registry=https://your-registry.comIf this fails, you're not logged in.
Verify your .npmrc has correct tokens:
# View .npmrc contents
cat ~/.npmrc
# Should contain something like:
# //registry.npmjs.org/:_authToken=npm_xxxxxFor scoped packages:
@myorg:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${NPM_TOKEN}Configure tokens for automated environments:
# Create .npmrc with token from environment variable
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrcGitHub Actions:
- name: Setup npm auth
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrcSome private registries require always-auth:
# Add to .npmrc
echo "always-auth=true" >> .npmrc
# Or set via npm config
npm config set always-auth trueIf tokens are stale, start fresh:
# Remove old config
rm ~/.npmrc
# Log in again
npm login
# Verify
npm whoaminpm 9+ changed authentication behavior:
- Defaults to web-based login
- Some private registries need --auth-type=legacy
- npm config set may not work for auth in npm 10+
For private registries like Artifactory or Nexus:
- Enable "npm Bearer Token Realm" in the server config
- Use legacy auth type if web login fails
.npmrc token formats:
# Bearer token (modern)
//registry.url/:_authToken=TOKEN
# Base64 auth (legacy)
//registry.url/:username=USER
//registry.url/:_password=BASE64_PASSnpm ERR! code ENOAUDIT npm ERR! Audit endpoint not supported
How to fix "npm ERR! code ENOAUDIT - Audit endpoint not supported"
npm ERR! code EBADDEVENGINES npm ERR! devEngines.runtime incompatible with current node version
How to fix "npm ERR! code EBADDEVENGINES - devEngines.runtime incompatible with current node version"
npm ERR! code ETOOMANYARGS npm ERR! Too many arguments
How to fix "npm ERR! code ETOOMANYARGS - Too many arguments"
npm ERR! code EINVALIDTAGNAME npm ERR! Invalid tag name: tag names cannot contain spaces
How to fix "npm ERR! code EINVALIDTAGNAME - tag names cannot contain spaces"
npm ERR! code E400 npm ERR! 400 Bad Request
How to fix "npm ERR! code E400 - 400 Bad Request" error