The npm deprecated warning indicates that a package in your dependency tree is no longer actively maintained or recommended for use. The package continues to work but will not receive updates, security patches, or new features.
The deprecated warning indicates that a package is no longer actively maintained or recommended for use. When you see this warning, it means a direct or indirect (transitive) dependency in your project relies on an outdated package. The package continues to work but will not receive updates, security patches, or new features. This is purely informational—the package will continue functioning, but maintainers strongly discourage new projects from using it. Deprecated packages can be direct dependencies in your package.json or transitive dependencies (a dependency of one of your dependencies).
Use npm explain to find the direct dependency chain:
npm explain requestThis shows which package in your dependency tree directly or indirectly requires the deprecated package. If it's a direct dependency, you control it. If it's transitive, you need the upstream maintainer to update their code.
List all instances of the deprecated package in your dependency tree:
npm ls requestThis shows the full tree of who depends on the deprecated package, helping you understand the scope of the problem.
If the deprecated package is a direct dependency, replace it with a modern alternative.
For example, replacing the deprecated 'request' package:
- axios - Popular, similar API, promise-based
- node-fetch - Lightweight, based on standard Fetch API
- Got - Fully TypeScript, actively maintained
npm uninstall request
npm install axiosUpdate your code to use the new package's API.
If the deprecated package comes from another package's dependencies, you cannot fix it directly. Instead:
1. File an issue or pull request on the upstream package's GitHub repository
2. Check if a newer version of the upstream package has already fixed this
3. As a temporary workaround, use npm overrides (npm v8.3.0+):
// In package.json
{
"overrides": {
"request": "npm:node-fetch@^3.0.0"
}
}Note: Overrides are a last resort and may cause compatibility issues.
Get a complete view of all deprecated packages:
jq -r '.packages | to_entries[] | select(.value.deprecated != null) | "\(.key):\n\(.value.deprecated)\n"' package-lock.jsonOr use a dedicated tool:
npx npm-deprecated-check currentThis helps identify all deprecated packages you should address.
After replacing deprecated packages, run your test suite:
npm test
npm run buildPay special attention to any code paths that use the replaced functionality, as different libraries have slightly different APIs.
Transitive dependency risk: According to security research, approximately 8.2% of the top 50,000 most-downloaded npm packages are officially deprecated. Deprecated transitive dependencies are particularly risky because developers often ignore them due to "alert fatigue."
Suppressing warnings: If you want to install without seeing these warnings, use npm install --loglevel=error, which suppresses only warnings. However, this is not a real fix—it merely hides the problem.
Built-in Fetch API: Node.js v18+ includes a native Fetch API, making many HTTP client libraries unnecessary:
// Modern Node.js 18+ (no external dependency needed)
const response = await fetch('http://api.example.com/data');
const data = await response.json();npm 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