How to fix npm ERR! code EAUDITNODATA npm ERR! audit Could not retrieve audit data in npm

npmBEGINNERMEDIUMUpdated Dec 5, 2025· 151 views

This error occurs when npm can't fetch security audit data from the registry. Usually caused by missing package-lock.json, network issues, or private registries that don't support audits.

Quick fix

Fixes npm ERR! code EAUDITNODATA npm ERR! audit Could not retrieve audit data

rm -rf node_modules package-lock.json
npm install
npm audit
  1. Regenerate package-lock.json
  2. Generate lock file only
  3. Use public registry for audit
  4. Check network connectivity
npm — error
rm -rf node_modules package-lock.json
npm install
npm audit
npm ERR! code EAUDITNODATA
npm ERR! audit Could not retrieve audit data

What this error means

The EAUDITNODATA error means npm couldn't retrieve vulnerability data from the registry's audit endpoint. npm audit works by sending your dependency tree to the registry's audit API, which checks it against a vulnerability database. This error typically occurs when: - There's no package-lock.json file (npm needs the exact dependency tree) - The registry doesn't support the audit endpoint - Network issues prevent reaching the audit service - The package-lock.json file is corrupted or incomplete

Typical symptoms

  • npm audit fails with EAUDITNODATA
  • Error mentions 'Could not retrieve audit data'
  • Works with public npm but fails with private registry
  • Happens after deleting package-lock.json

Common causes

  1. Missing package-lock.json file
  2. Corrupted or incomplete package-lock.json
  3. Private registry doesn't support audit API
  4. Network connectivity issues
  5. Registry's audit service temporarily unavailable
  6. Firewall blocking audit endpoint

How to fix "npm ERR! code EAUDITNODATA npm ERR! audit Could not retrieve audit data"

1Regenerate package-lock.json

The most common fix—regenerate the lock file:

bash
rm -rf node_modules package-lock.json
npm install
npm audit
2Generate lock file only

If you just need the lock file without installing:

bash
npm i --package-lock-only
npm audit
3Use public registry for audit

If using a private registry that doesn't support audits:

bash
npm audit --registry=https://registry.npmjs.org/

This sends audit requests to the public registry while keeping your private registry for package downloads.

4Check network connectivity

Verify you can reach the audit endpoint:

bash
# Test registry connectivity
npm ping

# Check audit endpoint
curl https://registry.npmjs.org/-/npm/v1/security/audits
5Update npm

Older npm versions may have audit issues:

bash
npm install -g npm@latest
6Skip audit if necessary

If audit is blocking and you need to proceed:

bash
npm install --no-audit

Note: This skips security checks. Only use temporarily and run npm audit manually later.

Advanced notes

Private registry solutions:
- Verdaccio, Nexus, and Artifactory don't natively support npm audit
- Use --registry=https://registry.npmjs.org/ for audit commands
- Consider npm-audit-proxy for air-gapped environments
- Some enterprise registries offer audit features separately

Offline environments: npm audit requires internet access to the vulnerability database. For air-gapped environments:
- Mirror the GitHub Advisory Database locally
- Use third-party tools that work with local vulnerability data
- Consider Snyk or similar tools with offline capabilities

CI/CD considerations: If audit fails in CI due to registry issues:

yaml
# Allow audit to fail without breaking build
npm audit || true

Frequently asked questions

What does "npm ERR! code EAUDITNODATA npm ERR! audit Could not retrieve audit dat" mean?
The EAUDITNODATA error means npm couldn't retrieve vulnerability data from the registry's audit endpoint. npm audit works by sending your dependency tree to the registry's audit API, which checks it against a vulnerability database.
How do I fix "npm ERR! code EAUDITNODATA npm ERR! audit Could not retrieve audit dat"?
This error occurs when npm can't fetch security audit data from the registry. Usually caused by missing package-lock.json, network issues, or private registries that don't support audits.
What causes "npm ERR! code EAUDITNODATA npm ERR! audit Could not retrieve audit dat"?
Missing package-lock.json file Corrupted or incomplete package-lock.json Private registry doesn't support audit API
Is the "npm ERR! code EAUDITNODATA npm ERR! audit Could not retrieve audit dat" error serious?
It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.

Official resources & further reading