diff --git a/docs/content/using-npm/config.md b/docs/content/using-npm/config.md index a6947b17d58d1..b9aa4070c863c 100644 --- a/docs/content/using-npm/config.md +++ b/docs/content/using-npm/config.md @@ -644,6 +644,25 @@ such as the one included with node 0.8, can install the package. This eliminates all automatic deduping. If used with `global-style` this option will be preferred. +#### legacy-peer-deps + +* Default: false +* Type: Boolean + +Causes npm to completely ignore `peerDependencies` when building a package +tree, as in npm versions 3 through 6. + +If a package cannot be installed because of overly strict +`peerDependencies` that collide, it provides a way to move forward +resolving the situation. + +This differs from `--omit=peer`, in that `--omit=peer` will avoid unpacking +`peerDependencies` on disk, but will still design a tree such that +`peerDependencies` _could_ be unpacked in a correct place. + +Use of `legacy-peer-deps` is not recommended, as it will not enforce the +`peerDependencies` contract that meta-dependencies may rely on. + #### link * Default: false diff --git a/lib/config/defaults.js b/lib/config/defaults.js index 8f3322099d35f..a4ac7a19f4af9 100644 --- a/lib/config/defaults.js +++ b/lib/config/defaults.js @@ -171,6 +171,7 @@ Object.defineProperty(exports, 'defaults', {get: function () { json: false, key: null, 'legacy-bundling': false, + 'legacy-peer-deps': false, link: false, 'local-address': undefined, loglevel: 'notice', @@ -316,6 +317,7 @@ exports.types = { json: Boolean, key: [null, String], 'legacy-bundling': Boolean, + 'legacy-peer-deps': Boolean, link: Boolean, 'local-address': getLocalAddresses(), loglevel: ['silent', 'error', 'warn', 'notice', 'http', 'timing', 'info', 'verbose', 'silly'], diff --git a/lib/config/flat-options.js b/lib/config/flat-options.js index e3ec59c1e79e1..6caa3c8c4b08a 100644 --- a/lib/config/flat-options.js +++ b/lib/config/flat-options.js @@ -165,6 +165,7 @@ const flatOptions = npm => npm.flatOptions || Object.freeze({ legacyBundling: npm.config.get('legacy-bundling'), scriptShell: npm.config.get('script-shell') || undefined, omit: buildOmitList(npm), + legacyPeerDeps: npm.config.get('legacy-peer-deps'), // used to build up the appropriate {add:{...}} options to Arborist.reify save: npm.config.get('save'),