Starting using Node.js and npm yesterday, so maybe this is a stupid question. Anyway, I'm going to use the counterparts in apt-system to describe my question. On apt-based Linux, installation is like
$ su --command='apt-get install foo'
It installs package foo and all dependencies of foo as well. Let's assume the dependencies are bar and baz, that is, the dependency hierarchy of foo is
foo
|- bar
`- baz
Now let's remove package foo with this command
$ su --command='apt-get remove --purge foo'
Both packages bar and baz will still exist in the system, even though they are no longer needed, because foo is gone. We can use next command to remove them, both bar and baz, the dependencies of foo.
$ su --command='apt-get autoremove --purge'
My question is: In npm
world, is there a similar command that can remove packages like apt-get autoremove --purge
does to packages of Linux distro?
Assume qux, quux and corge are Node.js packages, and the dependency hierarchy is
qux
|- quux
`- corge
As far as I know, if removing package qux with npm uninstall qux
, then packages quux and corge will still exist. How to remove them, those packages that were automatically installed by npm install qux
? Thanks.