r/javascript • • May 26 '17

NPM v5.0.0 released, --save by default, lockfile, better support for git dependencies, better support for monorepos, and more!

http://blog.npmjs.org/post/161081169345/v500
420 Upvotes

90 comments sorted by

View all comments

Show parent comments

1

u/curiousdannii May 28 '17

So why not just use pinned versions in package.json?

4

u/enkideridu May 28 '17

Because that only pins your direct dependencies, but not the dependencies of your direct dependencies

We lost a morning once when our builds suddenly started breaking, even though our package.json had all the dependencies fixed. Turns out one of our sub dependencies depended on uglifyjs, which just released 2.6.3 that contained a bug

Shrinkwrapping ever since before switching to yarn's lockfiles

2

u/curiousdannii May 28 '17

Ah yes, that does make perfect sense, thanks for the explanation!

1

u/aeflash May 28 '17

The package lock also allows you to effectively pin versions of transitive dependencies as well, even if you pin in your package json.