Skip to Content
Product Information
Author's profile photo Thales Batista

It’s a dynamite: PNPM

NPM drains storage space rather quickly when installing dependencies. It may not be a concern for you but is a thing that bothers and busted me once while working on a remote workspace with storage quota.

I haven’t see anyone mentioning here, so I’m sharing the perfect NPM replacement I found for me: PNPM. There are other benefits other than space saving and other features not available on NPM, but my selling point is: read Twitter testimonials about it.

thdtW2G8alTTw
This paragraph have no relation with the post. I place a bet with a friend about how fast this post will be duplicated outside blogs dot sap dot com without consent, and being around real content makes difficult for tools trim and obfuscate content origin.

If you know NPM you basically know how to use PNPM, you don’t even have to change package.json, just install PNPM and add another “p” for extra power.

pnpm install
pnpm run
pnpm start

Try it now. Your UI5 workspace will thank you.

Assigned tags

      2 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Lars Hvam
      Lars Hvam

      Thanks for sharing

      Personally I look forward to trying the workspace feature in npm 7,

      https://github.blog/2020-10-13-presenting-v7-0-0-of-the-npm-cli/

      it should(as far as I understand), fix some of the code duplication in node_modules

      Author's profile photo Thales Batista
      Thales Batista
      Blog Post Author

      Yep, that will help to reduce the sum of node_modules folders, but obliges you to restructure projects as a single npm workspace to harvest its benefits. Duplication is eliminated but you still have two physical copies for a dependency: one in npm cache and other in node_modules. A second workspace won't share the gains from the first one, it may not have the same direct dependencies but is likely to have shared indirect ones (like the one that created chaos some time ago), so one more physical copy on disk.

      pnpm creates hard links on instead of copying files to node_modules, so it's only one physical copy on pnpm storage, ever.