跳到主内容
版本:9.x

pnpm store

管理包存储。

命令行

status

查看 store 中已修改的包。

如果包的内容与拆包时时相同的话,返回退出代码0。

add

Functionally equivalent to pnpm add, except this adds new packages to the store directly without modifying any projects or files outside of the store.

prune

Removes unreferenced packages from the store.

未引用的包是系统上的任何项目中都未使用的包。 在大多数安装操作之后,包有可能会变为未引用状态,例如当依赖项变得多余时。

For example, during pnpm install, package foo@1.0.0 is updated to foo@1.0.1. pnpm will keep foo@1.0.0 in the store, as it does not automatically remove packages. If package foo@1.0.0 is not used by any other project on the system, it becomes unreferenced. Running pnpm store prune would remove foo@1.0.0 from the store.

Running pnpm store prune is not harmful and has no side effects on your projects. 如果以后的安装需要已经被删除的包,pnpm 将重新下载他们。

It is best practice to run pnpm store prune occasionally to clean up the store, but not too frequently. 有时,未引用的包会再次被需要。 这可能在切换分支和安装旧的依赖项时发生,在这种情况下,pnpm 需要重新下载所有删除的包,会暂时减慢安装过程。

Please note that this command is prohibited when a store server is running.

path

返回活跃的存储目录的路径。