YARN or NPM? Choose yarn. Right now!
nothingismagick last edited by nothingismagick
I just wanted to put down a collection of links and info about why I think that yarn is the right choice in general, and why I feel that it is the direction that quasar should take.
- npm install @babel/core --save > 12.721s reported vs 0m13.395s (time)
- yarn add @babel/core > Done in 3.98s. reported vs 0m4.480s (time)
Yarn has emoji. Interactive upgrading looks modernish. It caches and uses the cache intelligently. Less typing and less waiting means longer life - and faster CI.
Registry problems (hits yarn & npm)
- I am a teapot. Proxy requests broken, downgrade to Node 4 - fix made about 6 hours after report
- A feature request in npm since 2012: “Allow subdirectories within git repos in npm install” > https://github.com/npm/npm/issues/2974
- Possibly the reason why you sometimes have to delete the entire node_modules folder and rerun npm install: SHA1 collision. > https://github.com/zkat/cacache/issues/85
- “npm install --global” throws errors without sudo on linux
- upgrading quasar can sometimes inexplicably cause failures with babel linkage. (tip - upgrade npm)
Catastophic loss of files
- npm link fails and deletes folder contents (v3.10.9, v4.2.0)
- minor stable release of npm destroys linux systems (v5.7.0) - updating npm with npm did it, because npm itself ignored version hint
Yarn wins again:
- Something that won’t work in npm, but works out of the box in yarn-managed package.json > “test-base”: “link:./packages/base”
Management of and interaction with monorepos
- No real strategy for this with NPM - lerna is the current frontrunner, and they even offer several “yarn-only” features, such as workspaces.
- Also new on the scene (and promising) is bolt - which is yarn based.
Yarn is deterministic and NPM is not. eg. The same lockfile can produce different installs on different machines or in different circumstances… (Thanks @panstromek)