Live data from Hacker News

pnpm: Fast, disk space efficient package manager for JavaScript

pnpm.io

11–20 of 173 posts

Re: pnpm: Fast, disk space efficient package manager for JavaScript

#12

pnpm has been my goto JS monorepo package manager + script runner for a couple of years now. IMO it has almost zero downsides and huge upsides. I'd be surprised if npm doesn't end up adopting the pnpm node_modules directory hierarchy in the next 5 years or so.

I believe the RFC for just that has landed:

https://github.com/npm/rfcs/blob/main/accepted/0042-isolated...

Yarn has a PNPM mode now too:

https://dev.to/arcanis/yarn-31-corepack-esm-pnpm-optional-pa...

Re: pnpm: Fast, disk space efficient package manager for JavaScript

#13
post #6

Is there any gotcha if I switch from npm to pnpm? And can I use pnpm when working in a team where other devs use npm?

Pnpm doesn't auto install peer dependencies, which is annoying and forces you to unnecessary add them to package.json. Npm@7 (and newer) with auto install of peer deps is much easier to use in this regard.

Re: pnpm: Fast, disk space efficient package manager for JavaScript

#14
post #6

Is there any gotcha if I switch from npm to pnpm? And can I use pnpm when working in a team where other devs use npm?

Pnpm doesn't auto install peer dependencies, which is annoying and forces you to unnecessary add them to package.json. Npm@7 (and newer) with auto install of peer deps is much easier to use in this regard.

Isn't that exactly how it's supposed to be? If you're installing a package that has peer dependencies, you should already depend on them. Otherwise they are not "peer dependencies" anymore, just a normal dependency with a version range.

The whole peer dependencies story is another clusterfuck. Everyone simply ignored the invalid peer dependency warnings, and now npm itself will just install all of them in 'whatever works' version. To get real peer dependency resolution you need a --strict-peer-deps flag. Not exactly a "feature" in my book.

Re: pnpm: Fast, disk space efficient package manager for JavaScript

#15

Earlier quoted context omitted.

Pnpm doesn't auto install peer dependencies, which is annoying and forces you to unnecessary add them to package.json. Npm@7 (and newer) with auto install of peer deps is much easier to use in this regard.

Isn't that exactly how it's supposed to be? If you're installing a package that has peer dependencies, you should already depend on them. Otherwise they are not "peer dependencies" anymore, just a normal dependency with a version range. The whole peer dependencies story is another clusterfuck. Everyone simply ignored the invalid peer dependency warnings, and now npm itself will just install all of them in 'whatever w…

Yeah - this peer dependency thing always makes issues, when I try to upgrade a big Ionic project...

Peer dependencies added more problems than they solved in my eyes... Most peer dependencies warnings come because some maintainer forgot to update the package.json and not really because two packages don't work with each other...

Re: pnpm: Fast, disk space efficient package manager for JavaScript

#16
post #10
post #8

Earlier quoted context omitted.

pnpm uses its own lock file (pnpm-lock.yaml), while npm uses package-lock.json You definitely should use the same manager (npm, yarn, pnpm, whatever) as your teammates' or you're going to run into problems, either with them or with your CI workflow.

thanks!

note: You can use `pnpm import` for converting a lockfile.json to a pnpm-lock.yaml

https://pnpm.io/cli/import

(This is not an endorsement of or recommendation of pnpm which I personally don't use daily)

Re: pnpm: Fast, disk space efficient package manager for JavaScript

#19

This is my default one, _much_ faster and disk space reduced dramatically when I have lots of node_modules in use. Can't recommend enough.

Were you coming from yarn or npm? I guess their benchmarks cover both [0]. But I'm also curious about independent figures. [0] https://pnpm.io/benchmarks

used to use npm, less often with yarn, now it's all pnpm

Re: pnpm: Fast, disk space efficient package manager for JavaScript

#20
I recently migrated a large project from yarn to pnpm and the speed difference is insane. Everything related to dependencies runs must faster during local development AND CI. T The only tricky thing is that we had some issues with some dependencies that could not work properly. But using the “—-shamefully-hoist” flag did the trick. Everything works.
Post reply on HN