32

I'm currently working on a node.js-project and I've been keeping up with the most recent node releases during development. Now that node 6 is out, I wanted to see if I could make that decision as well.

It turns out some of the modules I use are dependent on older versions of graceful-fs which doesn't support node 6. I get warnings when installing and executing my application, but I can't determine where the graceful-fs package is being used (indirectly).

How can I find out?

DeX3
  • 5,200
  • 6
  • 44
  • 68

2 Answers2

63

I am fairly certain this is what you want:

npm ls graceful-fs

See documentation here.

Don Scott
  • 3,179
  • 1
  • 26
  • 40
  • 1
    I think this question refers to find which package are using a sub dependency. I think the op was looking for npm-explain that is available since v7 https://docs.npmjs.com/cli/v7/commands/npm-explain or with yarn-why https://classic.yarnpkg.com/en/docs/cli/why/ – gsouf Feb 22 '21 at 10:51
6

Copying from @Soufiane Ghzal's comment and the npm-ls docs:

To get a "bottoms up" view of why a given package is included in the tree at all, use npm explain.

Noumenon
  • 5,099
  • 4
  • 53
  • 73
  • 3
    `npm ls xxx` is a lot simpler to visualise, but thank you for adding this one. I'm in the middle of upgrading a massive project and was looking for the level of detail that npm explain shows (specifically the expected versions) – Jason Rogers Apr 14 '22 at 13:15