diff options
author | Kat Marchán <kzm@sykosomatic.org> | 2017-09-30 08:28:31 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2018-02-20 07:16:10 +0300 |
commit | e27674c221dc17473f23bffa50123e49a021ae34 (patch) | |
tree | 5607e07cd3c3df9924344e02f666cecc347a9c68 /doc | |
parent | 8279515903cfa3026cf7096189485cdf29f74a8f (diff) |
pkglock: automatically resolve conflicts
Diffstat (limited to 'doc')
-rw-r--r-- | doc/files/npm-package-locks.md | 19 | ||||
-rw-r--r-- | doc/files/package-lock.json.md | 1 |
2 files changed, 20 insertions, 0 deletions
diff --git a/doc/files/npm-package-locks.md b/doc/files/npm-package-locks.md index c57fc8565..cbb62bdc3 100644 --- a/doc/files/npm-package-locks.md +++ b/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 diff --git a/doc/files/package-lock.json.md b/doc/files/package-lock.json.md index 4c134fc22..6eac6bf10 100644 --- a/doc/files/package-lock.json.md +++ b/doc/files/package-lock.json.md @@ -128,5 +128,6 @@ The dependencies of this dependency, exactly as at the top level. * npm-shrinkwrap(1) * npm-shrinkwrap.json(5) +* npm-package-locks(5) * package.json(5) * npm-install(1) |