Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b8d593a

Browse filesBrowse files
authored
fix: npm 7 compat by turning on legacy-peer-deps flag (#5961)
1 parent a263da5 commit b8d593a
Copy full SHA for b8d593a

File tree

Expand file treeCollapse file tree

1 file changed

+9
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+9
-1
lines changed

‎packages/@vue/cli/lib/util/ProjectPackageManager.js

Copy file name to clipboardExpand all lines: packages/@vue/cli/lib/util/ProjectPackageManager.js
+9-1Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,10 @@ class PackageManager {
134134

135135
this.needsNpmInstallFix = true
136136
}
137+
138+
if (semver.gte(npmVersion, '7.0.0')) {
139+
this.needsPeerDepsFix = true
140+
}
137141
}
138142

139143
if (!SUPPORTED_PACKAGE_MANAGERS.includes(this.bin)) {
@@ -374,7 +378,7 @@ class PackageManager {
374378
return
375379
}
376380

377-
return await this.runCommand('install')
381+
return await this.runCommand('install', this.needsPeerDepsFix ? ['--legacy-peer-deps'] : [])
378382
}
379383

380384
async add (packageName, {
@@ -390,6 +394,10 @@ class PackageManager {
390394
}
391395
}
392396

397+
if (this.needsPeerDepsFix) {
398+
args.push('--legacy-peer-deps')
399+
}
400+
393401
return await this.runCommand('add', [packageName, ...args])
394402
}
395403

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.