mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-01-16 04:10:20 -06:00
fix: npm 7 compat by turning on legacy-peer-deps flag (#5961)
This commit is contained in:
@@ -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])
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user