Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Oct 15, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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