14

Is any easy way in npm to track from which packages these kind of dependency warnings came from? Packages in the warnings is for sure not the top level ones.

I'm currently on npm v3.6.0 (node 5.6.0).

Warnings when <code>npm install</code>

dmi3y
  • 3,482
  • 2
  • 21
  • 32

2 Answers2

12

Running npm list in your project directory will give you a dependency tree, and a simple text search for the deprecated packages will indicate where they came from.

As a workaround to deprecation issues, you could use npm-shrinkwrap (example usage).

Community
  • 1
  • 1
Kable
  • 1,035
  • 8
  • 18
  • 7
    Thanks, `npm list` is probably closest thing, although I was hoping to have something like `npm list --warnings` which filter out toplevel packages which are depend on packages that throwing warnings and indicates this packages... – dmi3y Apr 01 '16 at 06:45
0

I think npm explain is what you are looking for. Below is the console result when I look-up a package named stable in my current project. It indicates the package is installed by one of my dev dependencies named react-app-rewired.

$ npm explain stable
stable@0.1.8
node_modules/stable
  stable@"^0.1.8" from svgo@1.3.2
  node_modules/svgo
    svgo@"^1.2.2" from @svgr/plugin-svgo@5.5.0
    node_modules/@svgr/plugin-svgo
      @svgr/plugin-svgo@"^5.5.0" from @svgr/webpack@5.5.0
      node_modules/@svgr/webpack
        @svgr/webpack@"5.5.0" from react-scripts@4.0.3
        node_modules/react-scripts
          react-scripts@"4.0.3" from the root project
          peer react-scripts@">=2.1.3" from react-app-rewired@2.1.9
          node_modules/react-app-rewired
            dev react-app-rewired@"^2.1.9" from the root project
    svgo@"^1.0.0" from postcss-svgo@4.0.3
    node_modules/postcss-svgo
      postcss-svgo@"^4.0.3" from cssnano-preset-default@4.0.8
      node_modules/cssnano-preset-default
        cssnano-preset-default@"^4.0.8" from cssnano@4.1.11
        node_modules/cssnano
          cssnano@"^4.1.10" from optimize-css-assets-webpack-plugin@5.0.4
          node_modules/optimize-css-assets-webpack-plugin
            optimize-css-assets-webpack-plugin@"5.0.4" from react-scripts@4.0.3
            node_modules/react-scripts
              react-scripts@"4.0.3" from the root project
              peer react-scripts@">=2.1.3" from react-app-rewired@2.1.9
              node_modules/react-app-rewired
                dev react-app-rewired@"^2.1.9" from the root project