Skip to content

chore!: drop support of NPM 5 #6051

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

Merged
merged 1 commit into from
Nov 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/migrations/migrate-from-v4.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ If you want to migrate manually and gradually, you can run `vue upgrade <the-plu
### For All Packages

* Drop support of Node.js 8, 11, 13
* Drop support of NPM 5

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

Expand Down
4 changes: 1 addition & 3 deletions packages/@vue/cli-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,14 @@
"thread-loader": "^3.0.0",
"url-loader": "^4.1.1",
"vue-loader": "^15.9.2",
"vue-loader-v16": "npm:vue-loader@^16.0.0-beta.7",
"vue-style-loader": "^4.1.2",
"webpack": "^4.0.0",
"webpack-bundle-analyzer": "^3.8.0",
"webpack-chain": "^6.4.0",
"webpack-dev-server": "^3.11.0",
"webpack-merge": "^4.2.2"
},
"optionalDependencies": {
"vue-loader-v16": "npm:vue-loader@^16.0.0-beta.7"
},
"peerDependencies": {
"@vue/compiler-sfc": "^3.0.0-beta.14",
"vue-template-compiler": "^2.0.0"
Expand Down
28 changes: 2 additions & 26 deletions packages/@vue/cli/lib/util/ProjectPackageManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,11 @@ class PackageManager {
const npmVersion = stripAnsi(execa.sync('npm', ['--version']).stdout)

if (semver.lt(npmVersion, MIN_SUPPORTED_NPM_VERSION)) {
warn(
throw new Error(
'You are using an outdated version of NPM.\n' +
'there may be unexpected errors during installation.\n' +
'It does not support some core functionalities of Vue CLI.\n' +
'Please upgrade your NPM version.'
)

this.needsNpmInstallFix = true
}

if (semver.gte(npmVersion, '7.0.0')) {
Expand Down Expand Up @@ -356,28 +354,6 @@ class PackageManager {
}
}

if (this.needsNpmInstallFix) {
// if npm 5, split into several `npm add` calls
// see https://github.com/vuejs/vue-cli/issues/5800#issuecomment-675199729
const pkg = resolvePkg(this.context)
if (pkg.dependencies) {
const deps = Object.entries(pkg.dependencies).map(([dep, range]) => `${dep}@${range}`)
await this.runCommand('install', deps)
}

if (pkg.devDependencies) {
const devDeps = Object.entries(pkg.devDependencies).map(([dep, range]) => `${dep}@${range}`)
await this.runCommand('install', [...devDeps, '--save-dev'])
}

if (pkg.optionalDependencies) {
const devDeps = Object.entries(pkg.devDependencies).map(([dep, range]) => `${dep}@${range}`)
await this.runCommand('install', [...devDeps, '--save-optional'])
}

return
}

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

Expand Down