Skip to content

Commit

Permalink
fix: npm 7 compat by turning on legacy-peer-deps flag (#5961)
Browse files Browse the repository at this point in the history
  • Loading branch information
sodatea committed Oct 15, 2020
1 parent a263da5 commit b8d593a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/@vue/cli/lib/util/ProjectPackageManager.js
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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, {
Expand All @@ -390,6 +394,10 @@ class PackageManager {
}
}

if (this.needsPeerDepsFix) {
args.push('--legacy-peer-deps')
}

return await this.runCommand('add', [packageName, ...args])
}

Expand Down

0 comments on commit b8d593a

Please sign in to comment.