News for hackers. Stuff that matters.
Re:Hello Yarn 2, Goodbye node_modules by pmoleri on Monday August 09, 2021 @09:09PM (#28124204)
Wow, bold statement. Can you give examples of things it does wrong?
Re:Hello Yarn 2, Goodbye node_modules by danielheath on Monday August 09, 2021 @10:02PM (#28124470)
I can.

In most ecosystems, I can share package sources between a VM and a host.

npm shares mutable content (eg compiled artifacts) with package sources in `node_modules`. That breaks a ton of workflows that are common in other ecosystems.

For instance, in ruby apps using bundler, I can commit my dependencies in vendor/cache; there are no network dependencies other than fetching the source code. That makes turning code into a running server faster and more reliable.

Go supported the same thing from v1 via GOPATH (because that's how google runs their repo). Commit your dependencies and carry on (go had different shortcomings in dependency management in those days).

This feature turns things like `left-pad` from a fiasco into a non-event.

Also, it took npm years to implement a lockfile, only for most npm commands to disregard it. I used to frequently get versions other than the one I wanted. It's been ~6 years since I switched away so it may have improved since then. After my experience using npm I fundamentally do not trust the brand, and until yarn screws up I have no reason to give npm another chance.

Re:Hello Yarn 2, Goodbye node_modules by lhnz on Tuesday August 10, 2021 @05:31AM (#28126768)
There's nothing stopping you from running `npm` or `yarn` offline and committing the cache.

In fact, both of these package managers have had direct support for this workflow since 2016 (https://docs.npmjs.com/cli/v7/using-npm/config#offline) and 2017 (https://classic.yarnpkg.com/blog/2016/11/24/offline-mirror/) respectively.

Re:Hello Yarn 2, Goodbye node_modules by rlkf on Tuesday August 10, 2021 @05:03PM (#28134484)
Except that the format of the npm cache is version-specific. You would probably be better off using https://github.com/heikkipora/registry-sync instead.
Re:Hello Yarn 2, Goodbye node_modules by rlkf on Tuesday August 10, 2021 @04:59PM (#28134433)
`npm uninstall foo` simultaneously upgrades all the _other_ packages.

Experienced developers they are not.