Node.js npm Removing extraneous packages


Example

To remove extraneous packages (packages that are installed but not in dependency list) run the following command:

npm prune

To remove all dev packages add --production flag:

npm prune --production

More on it