diff options
Diffstat (limited to 'deps/npm/doc/files/npm-package-locks.md')
-rw-r--r-- | deps/npm/doc/files/npm-package-locks.md | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/deps/npm/doc/files/npm-package-locks.md b/deps/npm/doc/files/npm-package-locks.md index c57fc85658..cbb62bdc38 100644 --- a/deps/npm/doc/files/npm-package-locks.md +++ b/deps/npm/doc/files/npm-package-locks.md @@ -136,6 +136,25 @@ on. Additionally, the diffs from these changes are human-readable and will inform you of any changes npm has made to your `node_modules`, so you can notice if any transitive dependencies were updated, hoisted, etc. +### Resolving lockfile conflicts + +Occasionally, two separate npm install will create package locks that cause +merge conflicts in source control systems. As of `npm@5.7.0`, these conflicts +can be resolved by manually fixing any `package.json` conflicts, and then +running `npm install [--package-lock-only]` again. npm will automatically +resolve any conflicts for you and write a merged package lock that includes all +the dependencies from both branches in a reasonable tree. If +`--package-lock-only` is provided, it will do this without also modifying your +local `node_modules/`. + +To make this process seamless on git, consider installing +[`npm-merge-driver`](https://npm.im/npm-merge-driver), which will teach git how +to do this itself without any user interaction. In short: `$ npx +npm-merge-driver install -g` will let you do this, and even works with +pre-`npm@5.7.0` versions of npm 5, albeit a bit more noisily. Note that if +`package.json` itself conflicts, you will have to resolve that by hand and run +`npm install` manually, even with the merge driver. + ## SEE ALSO * https://medium.com/@sdboyer/so-you-want-to-write-a-package-manager-4ae9c17d9527 |