Skip to content

fix: incorrectly read Taobao binary mirror configuration. #5902

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 Sep 28, 2020
Merged
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
7 changes: 4 additions & 3 deletions packages/@vue/cli/lib/util/ProjectPackageManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,9 @@ class PackageManager {

try {
// node-sass, chromedriver, etc.
const binaryMirrorConfig = await this.getMetadata('binary-mirror-config')
const mirrors = binaryMirrorConfig.mirrors.china
const binaryMirrorConfigMetadata = await this.getMetadata('binary-mirror-config', { full: true })
const latest = binaryMirrorConfigMetadata['dist-tags'] && binaryMirrorConfigMetadata['dist-tags'].latest
const mirrors = binaryMirrorConfigMetadata.versions[latest].mirrors.china
for (const key in mirrors.ENVS) {
process.env[key] = mirrors.ENVS[key]
}
Expand Down Expand Up @@ -278,7 +279,6 @@ class PackageManager {
async getMetadata (packageName, { full = false } = {}) {
const scope = extractPackageScope(packageName)
const registry = await this.getRegistry(scope)
const authToken = await this.getAuthToken(scope)

const metadataKey = `${this.bin}-${registry}-${packageName}`
let metadata = metadataCache.get(metadataKey)
Expand All @@ -292,6 +292,7 @@ class PackageManager {
headers.Accept = 'application/vnd.npm.install-v1+json;q=1.0, application/json;q=0.9, */*;q=0.8'
}

const authToken = await this.getAuthToken(scope)
if (authToken) {
headers.Authorization = `Bearer ${authToken}`
}
Expand Down