Live data from Hacker News

pnpm: Fast, disk space efficient package manager for JavaScript

pnpm.io

61–70 of 173 posts

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

#61
post #49
post #11

Does this use symlinks to a single copy of each dependency?

Not symlinks. Hard links. Or copy-on-write on systems that support them.

[EDIT: (thanks ttybird2! b^)] We might need to change the following diagram?

https://pnpm.io/motivation

It appears to show several symlinks? Thanks for pnpm!

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

#62
post #57

As a person who uses npm just for some hobby coding projects, it's quite frustrating that there are new partly incompatible package managers for the javascript ecosystem: npm, pnpm, yarn, yarn 2. Some packages need one, some another, so I tried to switch to yarn (or yarn 2) for a package that I wanted to try out, but then other packages stopped working. If there are clearly better algorithms, why not refactor npm and…

> If there are clearly better algorithms, why not refactor npm and add them in experimental flags to npm While node_modules has many flaws, in the current ecosystem all modes have their own pros and cons, and there isn't a "clearly better" algorithm: node_modules has less friction, PnP is sounder, and pnpm's symlinks attempt to be kind of an in-between, offering half the benefits at half the "cost". Like in many comp…

pnpm also implements all three: https://pnpm.io/feature-comparison

But I think it is best to use Yarn for PnP and pnpm for the symlinked node_modules structure.

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

#63
post #31

Earlier quoted context omitted.

A single copy of each required version of each dependency.

So is that a yes? Or does it still pull a copy for each projects local node_modules?

As you can see at the URL in sibling, pnpm maintains a private area where everything is stored. Everything in a local (or "global", really) node_modules tree is a link to the private store.

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

#65

As a person who uses npm just for some hobby coding projects, it's quite frustrating that there are new partly incompatible package managers for the javascript ecosystem: npm, pnpm, yarn, yarn 2. Some packages need one, some another, so I tried to switch to yarn (or yarn 2) for a package that I wanted to try out, but then other packages stopped working. If there are clearly better algorithms, why not refactor npm and…

Given what a dumpster fire npm ecosystem is security wise, it's best to run the whole build chain in a container anyway, at least for frontend apps. This way you also don't care about the chosen package manager or node.js version - you can just set it as you wish in the Dockerfile. It does take more disk space though, but to me it's a nice compromise.

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

#66
post #47

I recently migrated a fairly large monorepo (20+ packages) that used Lerna and npm to pnpm, and the improvement in developer experience was pretty massive. Dependency install times went down by a huge amount, and all the strange issues we had with lerna and npm sometimes erroring out, requiring us to remove all node_modules folders and re-install everything, are just gone. We even noticed that the size of some of our…

I experienced the same. The overall dev experience / responsiveness of pakage management makes it very unlikely I would like to go back to npm ever.

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

#67
post #65

As a person who uses npm just for some hobby coding projects, it's quite frustrating that there are new partly incompatible package managers for the javascript ecosystem: npm, pnpm, yarn, yarn 2. Some packages need one, some another, so I tried to switch to yarn (or yarn 2) for a package that I wanted to try out, but then other packages stopped working. If there are clearly better algorithms, why not refactor npm and…

Given what a dumpster fire npm ecosystem is security wise, it's best to run the whole build chain in a container anyway, at least for frontend apps. This way you also don't care about the chosen package manager or node.js version - you can just set it as you wish in the Dockerfile. It does take more disk space though, but to me it's a nice compromise.

Containers don't provide much protection from malware, unless you're running it rootless under an unprivileged user (no sudo access, no ssh keys or anything else interesting in the home directory, etc; and even then it's limited because the attack surface is enormous).

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

#68
post #51
post #29

Earlier quoted context omitted.

"We will unblock it when you stop the war and de-occupy all the Ukrainian territory." There's what, maybe a handful of people who can make that happen?

That was the deal a few weeks ago. After the atrocities that their army has committed in my country, I do not think I will ever unblock traffic from Russian Federation.

Oh, I thought that you were Hungarian (after reading https://github.com/pnpm/pnpm/issues/1080#issuecomment-373872...), but I guess you are both? Your reaction makes more sense in that case. Although I do hope that you will reconsider the idea of a permanent block, I believe that open source (and the world in general) would be much worse and divides between nations would be greater if Greek software blocked Turkey, Israeli software blocked Germany, middle eastern software blocked the US, etc.

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

#69
post #58

As a person who uses npm just for some hobby coding projects, it's quite frustrating that there are new partly incompatible package managers for the javascript ecosystem: npm, pnpm, yarn, yarn 2. Some packages need one, some another, so I tried to switch to yarn (or yarn 2) for a package that I wanted to try out, but then other packages stopped working. If there are clearly better algorithms, why not refactor npm and…

Generally I've found sticking with npm to be best. It's not the super-slow thing that it was before, and I can't remember the last time a package didn't install because it wasn't compatible with npm. I tried pnpm and it didn't just work, so I gave up. I would revisit it, but npm works. These days I don't really see a reason to use yarn (but would like to hear them).

Yarn's workspaces provide some cool benefits to monorepos which AFAIK npm hasn't matched. You can get there with Lerna + npm, though.

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

#70
post #49

Earlier quoted context omitted.

Not symlinks. Hard links. Or copy-on-write on systems that support them.

[EDIT: (thanks ttybird2! b^)] We might need to change the following diagram? https://pnpm.io/motivation It appears to show several symlinks? Thanks for pnpm!

You are actually replying to the pnpm maintainer :p
Post reply on HN