我有一个包含 Javascript 和 Typescript 文件的项目。我正在使用 SonarCloud 从 Azure DevOps 管道分析这个项目。
我在构建管道中设置任务准备分析配置,如下所示:
- task: SonarCloudPrepare@1
inputs:
SonarCloud: 'Sonarcloud'
organization: 'MyOrg'
scannerMode: 'CLI'
configMode: 'manual'
cliProjectKey: 'My key'
cliProjectName: 'My name'
cliSources: '.'
运行管道时,我在Sonar Cloud 分析步骤的管道中出现以下错误
INFO: Found 1 tsconfig.json file(s): [/home/vsts/work/1/s/tsconfig.json]
##[error]ERROR: Cannot find module 'typescript'
##[error]ERROR: TypeScript dependency was not found and it is required for analysis.
ERROR: Install TypeScript in the project directory or use NODE_PATH env. variable to set TypeScript location, if it's located outside of project directory.
ERROR: TypeScript dependency was not found and it is required for analysis.
ERROR: Install TypeScript in the project directory or use NODE_PATH env. variable to set TypeScript location, if it's located outside of project directory.
##[error]ERROR: Missing TypeScript dependency
该分析适用于 javascript 文件,但不适用于 typescript 文件。我在 package.json 中将typescript包安装为 dev 依赖项,但它似乎被 SonarCloud 忽略了。
我找到的文档和主题与 SonarQube 版本有关,但我不知道如何使用SonarCloud进行设置。