我们使用 npm 包 sonarqube-scanner 版本 2.1.1 来分析我们的 angular/typescript 项目。但是从昨天开始,在从网站下载 Sonar 扫描仪时, Sonar 分析失败了 401。

我检查了 url,https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-3.2.0.1227-linux.zip 确实需要身份验证。有谁知道为什么或有解决方法?

09-Oct-2018 13:24:08    [11:24:08] Starting SonarQube analysis...
09-Oct-2018 13:24:08    [11:24:08] Checking if executable exists: /root/.sonar/native-sonar-scanner/sonar-scanner-3.2.0.1227-linux/bin/sonar-scanner
09-Oct-2018 13:24:08    [11:24:08] Could not find executable in "/root/.sonar/native-sonar-scanner".
09-Oct-2018 13:24:08    [11:24:08] Proceed with download of the platform binaries for SonarQube Scanner...
09-Oct-2018 13:24:08    [11:24:08] Creating /root/.sonar/native-sonar-scanner
09-Oct-2018 13:24:08    [11:24:08] Downloading from https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-3.2.0.1227-linux.zip
09-Oct-2018 13:24:08    [11:24:08] (executable will be saved in cache folder: /root/.sonar/native-sonar-scanner)
09-Oct-2018 13:24:09    [11:24:09] ERROR: impossible to download and extract binary: Response code 401 (Unauthorized)
09-Oct-2018 13:24:09    [11:24:09]        SonarQube Scanner binaries probably don't exist for your OS (linux).
09-Oct-2018 13:24:09    [11:24:09]        In such situation, the best solution is to install the standard SonarQube Scanner (requires a JVM).
09-Oct-2018 13:24:09    [11:24:09]        Check it out at https://redirect.sonarsource.com/doc/install-configure-scanner.html
09-Oct-2018 13:24:09

最佳答案

看起来他们更改了二进制下载的 url。如果您使用 npm 包,则需要安装 2.1.2

关于NPM sonarqube-scanner 失败并显示 401 Unauthorized,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/52723336/

10-14 12:51