Skip to content

Commit

Permalink
fix: incorrectly read Taobao binary mirror configuration. (#5902)
Browse files Browse the repository at this point in the history
Co-authored-by: zhangke <zhangke12@zybank.com.cn>
  • Loading branch information
godky and zhangke committed Sep 28, 2020
1 parent eda18b0 commit 286d068
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/@vue/cli/lib/util/ProjectPackageManager.js
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

0 comments on commit 286d068

Please sign in to comment.