npm-prune

删除未被列入依赖项的包

概要

npm prune [[<@scope>/]<pkg>...] [--production]

描述

删除未被列入依赖项的包,其意就是指包未被添加到package.json的dependencies和devDependencies中。

若指定包名pkg,则针对指定的包;若没有指定任何包名,则针对所有的包。

假如当前项目中安装了jquery包,但是jquery并没有添加到依赖项,执行命令则jquery包被删除。

> npm prune
removed 1 package

<试了,结果无效:If the --production flag is specified or the NODE_ENV environment variable is set to production, this command will remove the packages specified in your devDependencies. Setting --production=false will negate NODE_ENV being set to production.>

results matching ""

    No results matching ""