I have lot of dependencies installed. while npm install I am getting npm warn deprecated please update to some version. how to find which package produces this warning.
I have lot of dependencies installed. while npm install I am getting npm warn deprecated please update to some version. how to find which package produces this warning.
npm outdated only shows packages that have newer versions available, independent of their deprecation status. Thus, it does not show deprecated packages that won't get updates anymore (e.g. request or @hapi/joi).
If you use npm version 7 or newer, you should have a package-lock.json with lockfileVersion: 2. This lockfile contains the deprecation warnings of all installed packages.
You can use jq to find all packages that have deprecation warnings:
jq -r '.packages | to_entries[] | select(.value.deprecated != null) | "\(.key):\n\(.value.deprecated)\n"' package-lock.json
The output will look like this:
node_modules/har-validator: this library is no longer supported node_modules/request: request has been deprecated, see https://github.com/request/request/issues/3142 node_modules/request-oauth/node_modules/uuid: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. node_modules/request/node_modules/uuid: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
Open your terminal and run these two commands:
cdnpm outdatedIt should return a list of outdated packages that need to be upgraded.