Skip to content

Commit 66a87f2

Browse files
authored
chore!: drop support of NPM 5 (#6051)
1 parent cb5f117 commit 66a87f2

File tree

3 files changed

+4
-29
lines changed

3 files changed

+4
-29
lines changed

docs/migrations/migrate-from-v4.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ If you want to migrate manually and gradually, you can run `vue upgrade <the-plu
3737
### For All Packages
3838

3939
* Drop support of Node.js 8, 11, 13
40+
* Drop support of NPM 5
4041

4142
### The `vue` Command (The Global `@vue/cli` Package)
4243

packages/@vue/cli-service/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,14 @@
7272
"thread-loader": "^3.0.0",
7373
"url-loader": "^4.1.1",
7474
"vue-loader": "^15.9.2",
75+
"vue-loader-v16": "npm:vue-loader@^16.0.0-beta.7",
7576
"vue-style-loader": "^4.1.2",
7677
"webpack": "^4.0.0",
7778
"webpack-bundle-analyzer": "^3.8.0",
7879
"webpack-chain": "^6.4.0",
7980
"webpack-dev-server": "^3.11.0",
8081
"webpack-merge": "^4.2.2"
8182
},
82-
"optionalDependencies": {
83-
"vue-loader-v16": "npm:vue-loader@^16.0.0-beta.7"
84-
},
8583
"peerDependencies": {
8684
"@vue/compiler-sfc": "^3.0.0-beta.14",
8785
"vue-template-compiler": "^2.0.0"

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

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,11 @@ class PackageManager {
126126
const npmVersion = stripAnsi(execa.sync('npm', ['--version']).stdout)
127127

128128
if (semver.lt(npmVersion, MIN_SUPPORTED_NPM_VERSION)) {
129-
warn(
129+
throw new Error(
130130
'You are using an outdated version of NPM.\n' +
131-
'there may be unexpected errors during installation.\n' +
131+
'It does not support some core functionalities of Vue CLI.\n' +
132132
'Please upgrade your NPM version.'
133133
)
134-
135-
this.needsNpmInstallFix = true
136134
}
137135

138136
if (semver.gte(npmVersion, '7.0.0')) {
@@ -356,28 +354,6 @@ class PackageManager {
356354
}
357355
}
358356

359-
if (this.needsNpmInstallFix) {
360-
// if npm 5, split into several `npm add` calls
361-
// see https://github.com/vuejs/vue-cli/issues/5800#issuecomment-675199729
362-
const pkg = resolvePkg(this.context)
363-
if (pkg.dependencies) {
364-
const deps = Object.entries(pkg.dependencies).map(([dep, range]) => `${dep}@${range}`)
365-
await this.runCommand('install', deps)
366-
}
367-
368-
if (pkg.devDependencies) {
369-
const devDeps = Object.entries(pkg.devDependencies).map(([dep, range]) => `${dep}@${range}`)
370-
await this.runCommand('install', [...devDeps, '--save-dev'])
371-
}
372-
373-
if (pkg.optionalDependencies) {
374-
const devDeps = Object.entries(pkg.devDependencies).map(([dep, range]) => `${dep}@${range}`)
375-
await this.runCommand('install', [...devDeps, '--save-optional'])
376-
}
377-
378-
return
379-
}
380-
381357
return await this.runCommand('install', this.needsPeerDepsFix ? ['--legacy-peer-deps'] : [])
382358
}
383359

0 commit comments

Comments
 (0)