[{"data":1,"prerenderedAt":29},["ShallowReactive",2],{"$fLV2cFuW_amKl0AairjUpjWqYBC3IVWyq8HLEs6to4eE":3},{"slug":4,"title":5,"description":6,"date":7,"tags":8,"draft":13,"readingMinutes":14,"html":15,"related":16},"pnpm-vs-npm","pnpm vs npm: Which One I'd Pick for a New Project","pnpm vs npm in November 2026: disk use, install speed, strict node_modules, build scripts, release-age delays and monorepos, and when switching is worth it.","2026-11-24",[9,10,11,12],"pnpm","npm","javascript","node",false,4,"\u003Cp>Short answer: for a new project, pnpm. For an existing project that works fine on npm and has one developer, probably leave it alone. The interesting part is why, because the reasons people usually give (speed, disk space) aren&#39;t the ones that matter most anymore.\u003C/p>\n\u003Cp>Versions as of November 24, 2026 on the npm registry: \u003Ca href=\"https://pnpm.io/\">pnpm\u003C/a> is at 12.23.0 (released November 22), with the 11.x line still getting fixes (11.29.0 the same day). npm is at 12.2.3 (November 18). Node 24 LTS still ships npm 11, so \u003Ccode>npm -v\u003C/code> on most machines says 11.x until you upgrade it yourself.\u003C/p>\n\u003Ch2>What&#39;s actually different\u003C/h2>\n\u003Cp>Both read the same \u003Ccode>package.json\u003C/code> and pull from the same registry. The difference is what they put on disk.\u003C/p>\n\u003Cp>\u003Cstrong>npm\u003C/strong> copies every package into each project&#39;s \u003Ccode>node_modules\u003C/code> and flattens the tree, hoisting dependencies to the top level so they&#39;re easy to find. Ten projects using React means ten copies of React.\u003C/p>\n\u003Cp>\u003Cstrong>pnpm\u003C/strong> keeps one copy of every package version in a global content-addressable store and hard-links it into each project. Then it builds \u003Ccode>node_modules\u003C/code> out of symlinks, so your project&#39;s top level holds only the packages you actually listed in \u003Ccode>package.json\u003C/code>. Everything else sits in \u003Ccode>node_modules/.pnpm\u003C/code>. The \u003Ca href=\"https://pnpm.io/symlinked-node-modules-structure\">pnpm docs on symlinked node_modules\u003C/a> explain the layout properly.\u003C/p>\n\u003Cimg src=\"/blog/pnpm-vs-npm/node-modules-two-layouts.webp\" alt=\"npm flattens every package into one node_modules folder, pnpm links only declared packages from a shared store\" width=\"1600\" height=\"690\" loading=\"lazy\">\u003Ch2>The reason I&#39;d switch: phantom dependencies\u003C/h2>\n\u003Cp>That symlink layout sounds like an implementation detail. It isn&#39;t. With npm&#39;s flat tree, your code can \u003Ccode>import\u003C/code> a package you never installed, because something else pulled it in and it got hoisted. It works on your machine. Then a minor update of the other package drops it, and production breaks on a dependency you didn&#39;t know you had.\u003C/p>\n\u003Cp>pnpm makes that import fail immediately, on day one, on your laptop. That&#39;s annoying for about a week when you first convert an old project, because you find all the missing lines in \u003Ccode>package.json\u003C/code>. After that it&#39;s the most useful thing the tool does. In a codebase written partly by AI assistants, which happily import whatever they&#39;ve seen before, I&#39;d call it essential.\u003C/p>\n\u003Ch2>Security defaults\u003C/h2>\n\u003Cp>This is where the gap has grown. pnpm stopped running dependency lifecycle scripts (\u003Ccode>postinstall\u003C/code> and friends) by default in version 10. A package that needs a build step has to be approved, with \u003Ccode>pnpm approve-builds\u003C/code> or an allow list in the config. Most supply-chain attacks of the last few years ran through exactly those install scripts.\u003C/p>\n\u003Cp>pnpm also has \u003Ccode>minimumReleaseAge\u003C/code>, which refuses versions published less than a set time ago, so a hijacked release that gets pulled within hours never reaches you. The November releases keep tightening this: 11.29.0 added a \u003Ccode>--minimum-release-age\u003C/code> command-line option, and 12.22.0 fixed a case where a registry change skipped the check.\u003C/p>\n\u003Cp>npm runs install scripts unless you set \u003Ccode>ignore-scripts=true\u003C/code> in \u003Ccode>.npmrc\u003C/code>, which you can, but almost nobody does, and then the packages that genuinely need a build step silently don&#39;t get one.\u003C/p>\n\u003Ch2>Speed and disk\u003C/h2>\n\u003Cp>pnpm is faster on repeat installs and in CI with a cached store, and uses far less disk when you have many projects. On a single project with a warm npm cache the difference is smaller than the benchmarks suggest. If install time is your only complaint, it&#39;s not a strong reason to switch on its own. Lockfile churn in pull requests tends to matter more day to day.\u003C/p>\n\u003Ch2>Monorepos\u003C/h2>\n\u003Cp>If you have more than one package in a repo, pnpm workspaces are simply nicer. The \u003Ccode>workspace:\u003C/code> protocol links local packages explicitly, \u003Ccode>pnpm --filter\u003C/code> runs a command in one package and its dependents, and catalogs let you pin one version of React for every package in a single place. npm has workspaces too, and they work, but the filtering and version control are thinner.\u003C/p>\n\u003Ch2>When I&#39;d stay on npm\u003C/h2>\n\u003Cul>\n\u003Cli>A small project, one developer, no complaints. Switching costs an afternoon and buys little.\u003C/li>\n\u003Cli>A hosting platform or tool that only documents npm, and you don&#39;t want to be the person debugging its pnpm support.\u003C/li>\n\u003Cli>A team that won&#39;t install anything new. Everyone already has npm with Node.\u003C/li>\n\u003C/ul>\n\u003Ch2>Switching takes about an hour\u003C/h2>\n\u003Cp>Delete \u003Ccode>node_modules\u003C/code> and \u003Ccode>package-lock.json\u003C/code>, run \u003Ccode>pnpm import\u003C/code> first if you want pnpm to start from the npm lockfile&#39;s versions, then \u003Ccode>pnpm install\u003C/code>. Add \u003Ccode>&quot;packageManager&quot;: &quot;pnpm@12.23.0&quot;\u003C/code> to \u003Ccode>package.json\u003C/code> so everyone and CI use the same version. Fix the phantom imports it finds. Approve the build scripts you actually need. Update CI to cache the pnpm store instead of \u003Ccode>~/.npm\u003C/code>.\u003C/p>\n\u003Cp>The \u003Ca href=\"https://pnpm.io/feature-comparison\">pnpm feature comparison\u003C/a> lists the rest, and the \u003Ca href=\"https://docs.npmjs.com/cli/\">npm CLI docs\u003C/a> cover the npm side, including \u003Ccode>npm ci\u003C/code> for clean installs from the lockfile.\u003C/p>\n\u003Cp>If you&#39;ve got a Node project with a dependency mess, a slow CI pipeline, or an install that only works on one person&#39;s laptop, \u003Ca href=\"https://calendly.com/director-norsky/meeting\">book a free call\u003C/a>. All consultation is free.\u003C/p>\n",[17,21,25],{"slug":18,"title":19,"description":20},"typescript-vs-javascript","TypeScript vs JavaScript in 2026: When I'd Still Skip the Types","TypeScript vs JavaScript from a developer who writes both: what types catch, what they cost, Node running .ts files directly, and when plain JS is the right call.",{"slug":22,"title":23,"description":24},"bun-vs-node","Bun vs Node in Late 2026: What I'd Run in Production","Bun vs Node in October 2026: Bun 1.4.4 against Node 24 and the Node 26 LTS that lands on October 28. Where Bun is ready, where it isn't, and what I'd pick.",{"slug":26,"title":27,"description":28},"nextjs-vs-react","Next.js vs React: You're Choosing a Server, Not a Library","Next.js vs React in November 2026: what Next adds on top of React 19, when plain React with Vite is the better start, and the cost nobody mentions.",1795910047503]