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.

- 4,764
- 3
- 25
- 35

- 4,486
- 7
- 33
- 57
-
Check http://stackoverflow.com/a/36341065/1740715 – Harikrishnan May 21 '17 at 13:24
-
that will suggestions for all @Harikrishnan. I want to see that in particular. – Sibiraj May 24 '17 at 09:21
4 Answers
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.

- 350
- 3
- 7
-
1If this returns transitive dependencies that aren't declared in your package.json, `npm explain
` will show the declared dependencies are bringing them in. – ParkerM Nov 20 '22 at 00:45
Open your terminal and run these two commands:
cd
npm outdated
It should return a list of outdated packages that need to be upgraded.

- 169
- 1
- 9
-
7Deprecated notices come from sub-dependencies. `npm outdated` does not consider sub-dependencies. Updating direct dependencies might fix the issue, or it might not. – fregante Dec 28 '20 at 01:15
Problem: npm i
gives you warns about a deprecated sub-dependency.
Fix: npm list --depth=3 >> result.txt
then you can search in that file for the deprecated sub package

- 764
- 8
- 19