PageSourceSearch

https://pnpm.io/assets/js/772959f1.28cd8823.js

js pnpm.io collected 2026-09-24 07:23:34 UTC 4,902 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([["22672"],{84644(e,n,t){t.r(n),t.d(n,{metadata:()=>s,default:()=>p,frontMatter:()=>i,contentTitle:()=>a,toc:()=>c,assets:()=>d});var s=JSON.parse('{"id":"cli/store","title":"pnpm store","description":"Managing the package store.","source":"@site/versioned_docs/version-11.x/cli/store.md","sourceDirName":"cli","slug":"/cli/store","permalink":"/11.x/cli/store","draft":false,"unlisted":false,"editUrl":"https://github.com/pnpm/pnpm.io/edit/main/versioned_docs/version-11.x/cli/store.md","tags":[],"version":"11.x","lastUpdatedBy":"Zoltan Kochan","lastUpdatedAt":1788556519000,"frontMatter":{"id":"store","title":"pnpm store"},"sidebar":"docs","previous":{"title":"pnpm -r, --recursive","permalink":"/11.x/cli/recursive"},"next":{"title":"pnpm root","permalink":"/11.x/cli/root"}}'),o=t(91987),r=t(67008);let i={id:"store",title:"pnpm store"},a,d={},c=[{value:"Commands",id:"commands",level:2},{value:"status",id:"status",level:3},{value:"add",id:"add",level:3},{value:"prune",id:"prune",level:3},{value:"path",id:"path",level:3}];function l(e){let n={a:"a",code:"code",em:"em",h2:"h2",h3:"h3",p:"p",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.p,{children:"Managing the package store."}),"\n",(0,o.jsx)(n.h2,{id:"commands",children:"Commands"}),"\n",(0,o.jsx)(n.h3,{id:"status",children:"status"}),"\n",(0,o.jsx)(n.p,{children:"Checks for modified packages in the store."}),"\n",(0,o.jsx)(n.p,{children:"Returns exit code 0 if the content of the package is the same as it was at the\ntime of unpacking."}),"\n",(0,o.jsx)(n.h3,{id:"add",children:"add"}),"\n",(0,o.jsxs)(n.p,{children:["Functionally equivalent to ",(0,o.jsx)(n.a,{href:"/11.x/cli/add",children:(0,o.jsx)(n.code,{children:"pnpm add"})}),", except this adds new packages to the\nstore directly without modifying any projects or files outside of the store."]}),"\n",(0,o.jsx)(n.h3,{id:"prune",children:"prune"}),"\n",(0,o.jsxs)(n.p,{children:["Removes ",(0,o.jsx)(n.em,{children:"unreferenced packages"})," from the store."]}),"\n",(0,o.jsx)(n.p,{children:"Unreferenced packages are packages that are not used by any projects on the\nsystem. Packages can become unreferenced after most installation operations, for\ninstance when dependencies are made redundant."}),"\n",(0,o.jsxs)(n.p,{children:["For example, during ",(0,o.jsx)(n.code,{children:"pnpm install"}),", package ",(0,o.jsx)(n.code,{children:"[email protected]"})," is updated to\n",(0,o.jsx)(n.code,{children:"[email protected]"}),". pnpm will keep ",(0,o.jsx)(n.code,{children:"[email protected]"})," in the store, as it does not\nautomatically remove packages. If package ",(0,o.jsx)(n.code,{children:"[email protected]"})," is not used by any other\nproject on the system, it becomes unreferenced. Running ",(0,o.jsx)(n.code,{children:"pnpm store prune"})," would\nremove ",(0,o.jsx)(n.code,{children:"[email protected]"})," from the store."]}),"\n",(0,o.jsxs)(n.p,{children:["Running ",(0,o.jsx)(n.code,{children:"pnpm store prune"})," is not harmful and has no side effects on your\nprojects. If future installations require removed packages, pnpm will download\nthem again."]}),"\n",(0,o.jsxs)(n.p,{children:["It is best practice to run ",(0,o.jsx)(n.code,{children:"pnpm store prune"})," occasionally to clean up the\nstore, but not too frequently. Sometimes, unreferenced packages become required\nagain. This could occur when switching branches and installing older\ndependencies, in which case pnpm would need to re-download all removed packages,\nbriefly slowing down the installation process."]}),"\n",(0,o.jsx)(n.p,{children:"After pruning, pnpm displays the total size of removed files."}),"\n",(0,o.jsxs)(n.p,{children:["When the ",(0,o.jsx)(n.a,{href:"/11.x/settings/node-modules#enableglobalvirtualstore",children:"global virtual store"})," is enabled, ",(0,o.jsx)(n.code,{children:"pnpm store prune"})," also performs mark-and-sweep garbage collection on the global virtual store's ",(0,o.jsx)(n.code,{children:"links/"})," directory. Projects using the store are registered via symlinks in ",(0,o.jsx)(n.code,{children:"{storeDir}/v11/projects/"}),", allowing pnpm to track active usage and safely remove unused packages from the global virtual store."]}),"\n",(0,o.jsx)(n.h3,{id:"path",children:"path"}),"\n",(0,o.jsx)(n.p,{children:"Returns the path to the active store directory."})]})}function p(e={}){let{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(l,{...e})}):l(e)}},67008(e,n,t){t.d(n,{R:()=>i,x:()=>a});var s=t(71763);let o={},r=s.createContext(o);function i(e){let n=s.useContext(r);return s.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),s.createElement(r.Provider,{value:n},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.