News for hackers. Stuff that matters.
Re:Hello Yarn 2, Goodbye node_modules by pmoleri on Monday August 09, 2021 @07:38PM (#28123646)
IMO, npm is a breeze compared to pip. With npm you know that `npm i && npm start` will start 95% of the projects cross-platform. It allows having different subdependencies versions in a way that just works. It encourages semver but at the same time you have lock file. Is highly customizable with rc files.

Perhaps I just don't have that much experience with pip, but it feels more like a tool to install packages, then you're on your own with some makefile or python scripts with no standard setup.

Re:Hello Yarn 2, Goodbye node_modules by ezekg on Monday August 09, 2021 @08:57PM (#28124135)
npm is one of the only dependency managers I’ve seen that does more than install packages. Every other package manager: pip, bundler, composer, all do one thing and do it well. npm does everything but nothing well.
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.

Re:Hello Yarn 2, Goodbye node_modules by norman784 on Tuesday August 10, 2021 @02:13PM (#28132221)
Cargo from rust does more than npm and IMHO it does very well.