fix: npm 7 compat by turning on legacy-peer-deps flag (#5961)

This commit is contained in:
Haoqun Jiang
2020-10-15 15:23:24 +08:00
committed by GitHub
parent a263da560e
commit b8d593ab59

View File

@@ -134,6 +134,10 @@ class PackageManager {
this.needsNpmInstallFix = true
}
if (semver.gte(npmVersion, '7.0.0')) {
this.needsPeerDepsFix = true
}
}
if (!SUPPORTED_PACKAGE_MANAGERS.includes(this.bin)) {
@@ -374,7 +378,7 @@ class PackageManager {
return
}
return await this.runCommand('install')
return await this.runCommand('install', this.needsPeerDepsFix ? ['--legacy-peer-deps'] : [])
}
async add (packageName, {
@@ -390,6 +394,10 @@ class PackageManager {
}
}
if (this.needsPeerDepsFix) {
args.push('--legacy-peer-deps')
}
return await this.runCommand('add', [packageName, ...args])
}