Skip to:

Opened 22 months ago

Closed 22 months ago

Last modified 21 months ago

#3113 closed defect (fixed)

Add npm `package-lock.json` for npm v5.x

Reported by: netweb Owned by: netweb
Milestone: 2.6 Priority: normal
Severity: normal Version:
Component: Tools - Build Keywords:


npm v5 now by default generates a package-lock.json file

Some paraphrased notes from the announcement post:

  • package-lock.json and npm-shrinkwrap.json are aware of each other and happy to coexist
  • package locks no longer exclude optionalDependencies that failed to build. This means package-lock.json and npm-shrinkwrap.json should now be cross-platform.
    • This will hopefully mitigate the optionalDependencies issue with our build server in #38657 / r39368, when the build server is bumped to use the upcoming Node.js v8.x LTS release this can be tested and confirmed.
  • Running npm while offline will no longer insist on retrying network requests. npm will now immediately fall back to cache if possible, or fail, npm's caching is vastly improved in npm 5
  • On performance, NodeJS 6.9.1 and NPM 3.10.8 running npm install in tests took ~65.44 seconds on average, with NodeJS v7.10.0 and npm v5.0.0 this is down to one third at ~20.471 seconds on average, once npm modules are cached reinstalling node_modules averages 11.313 seconds, just shy of a 6x speed boost

Related: #WP40938 Add npm package-lock.json for npm v5.x

Attachments (1)

Screen Shot 2017-06-07 at 11.28.18 AM.png (277.9 KB) - added by johnjamesjacoby 22 months ago.

Download all attachments as: .zip

Change History (5)

#1 @netweb
22 months ago

  • Owner set to netweb
  • Resolution set to fixed
  • Status changed from new to closed

In 6494:

Build Tools: Add npm package-lock.json for npm v5.x

This changeset adds support for npm 5 which include significant performance improvements, these are primarily due updated caching, offline caching and the addition of a package-lock.json to leverage the new caching.

To install and use npm 5 with your existing install of Node.js 6 or 7 run npm i npm@5 -g. Node.js 8 support will be added in a follow up ticket.

Installing npm modules for bbPress is now ~6x faster with npm 5 🏎

Fixes #3113.

#2 follow-up: @johnjamesjacoby
22 months ago

Above was with:

  • Node v8.0.0
  • NPM v5.0.3

A second call to npm install finished in 5.684s.

Last edited 22 months ago by johnjamesjacoby (previous) (diff)

#3 in reply to: ↑ 2 @netweb
22 months ago

Replying to johnjamesjacoby:

A second call to npm install finished in 5.684s.


#4 @netweb
21 months ago

In 6626:

Build Tools: Update package.json dependencies and package-lock.json

This changeset primarily updates the package-lock.json file to support the latest npm 5.1 and 5.2 releases.

  • The format of the package-lock.json changed slightly with npm 5.1 to better support devDependencies dependencies.
  • Explicitly update all dependencies to the latest available version.
  • Updates postcss-scss to use semantic version _patch_ ~ in line with the other npm modules used.

See #3113.

Note: See TracTickets for help on using tickets.