Skip to content

How to: regenerate lock files

Evan Bruhn edited this page Jan 8, 2019 · 1 revision

Re-generating lock files

Sometimes a dependency has gone bad, and you need to upgrade it to resolve local or Travis build issues. Common bad dependencies are:

  • natives~1.1.3: Breaks gulp on Node 10 or above
  • node-sass (via gulp-sass): Breaks travis

If you like, you can go in and just update the bad dependencies, but sometimes it's just easier to regenerate the whole lock file. To do so:

rm yarn.lock package-lock.json
rm -rf node_modules/
yarn install
rm -rf node_modules/
npm i

Why are we deleting node_modules? To make sure that yarn install and npm i were actually successful. Basically, we're testing that the lock files we're generate result in a successful build.

Once complete, commit the package-lock.json and yarn.lock.