pnpm clean

별칭: purge

모든 워크스페이스 프로젝트에서 node_modules의 내용을 안전하게 제거합니다. Node.js를 사용해 디렉터리를 제거하므로, Windows의 NTFS 정션을 대상까지 따라가지 않고 올바르게 처리합니다.

In a workspace, pnpm clean removes node_modules in the root and every workspace package by default, even when the workspace root has no package.json. Passing --filter, --filter-prod, --workspace-root, or --no-recursive cleans only the selected projects and preserves the shared virtual store (node_modules/.pnpm) when the workspace uses a shared lockfile. pnpm clean preserves non-pnpm hidden entries (e.g., .cache) inside node_modules and cleans a custom modulesDir when set.

If a custom virtualStoreDir resides inside the project root, an unfiltered pnpm clean removes it too.

With nodeLinker: pnp, a full clean also removes the generated .pnp.cjs loader. A filtered clean preserves a loader shared by workspace projects.

옵션#

--lockfile, -l#

Also remove the pnpm-lock.yaml files of the cleaned projects and, when pnpm clean cleans the workspace root, a lockfile inside lockfileDir if that directory is inside the workspace root.

--lockfile-dir <dir>#

The directory that holds pnpm-lock.yaml. --lockfile removes the lockfile there when that directory is inside the workspace or project root.

--filter <package_selector>#

필터링에 대해 자세히 알아보세요.