【发布时间】:2019-12-21 01:49:33
【问题描述】:
我有一个 jenkins 管道,我正在尝试扫描一个角度网站以查找 sonarqube,但我遇到了这个错误:
ERROR: internal/modules/cjs/loader.js:582
ERROR: throw err;
ERROR: ^
ERROR:
ERROR: Error: Cannot find module 'typescript'
ERROR: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
ERROR: at Function.Module._load (internal/modules/cjs/loader.js:506:25)
ERROR: at Module.require (internal/modules/cjs/loader.js:636:17)
ERROR: at require (internal/modules/cjs/helpers.js:20:18)
ERROR: at Object.<anonymous> (D:\SonarQube\ajbic-client-app\.scannerwork\sonarts-bundle\node_modules\tslint\lib\language\walker\blockScopeAwareRuleWalker.js:20:10)
ERROR: at Module._compile (internal/modules/cjs/loader.js:688:30)
ERROR: at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
ERROR: at Module.load (internal/modules/cjs/loader.js:598:32)
ERROR: at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
ERROR: at Function.Module._load (internal/modules/cjs/loader.js:529:3)
ERROR: Failed to find 'typescript' module. Please check, NODE_PATH contains location of global 'typescript' or install locally in your project
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
我在 jenkins 中的设置是这样的:
steps {
withSonarQubeEnv('Dev-build-01') {
bat "cd D:/SonarQube/abcd-webapp"
bat "rm -rf node_modules package-lock.json"
bat "npm install"
bat "C:/Jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation/SonarQubeScanner/Net/bin/sonar-scanner.bat -D sonar.projectKey=abcd-webapp -D sonar.sources=src -D sonar.login=667723c08ecfe0fc0d5c0e91bdd5c4b219e851e7 -D sonar.projectBaseDir=D:/SonarQube/abcd-webapp"
}
timeout(time: 60, unit: 'MINUTES') {
// waitForQualityGate abortPipeline: true
}
}
}
我已经完成了通常的工作,安装了 typescript(下载和通过 npm),但每次我都遇到同样的错误。 还有一件奇怪的事情是,当我删除阶段并保存时,管道仍在进行分析。
有人知道该怎么做吗?
谢谢
【问题讨论】:
标签: angular typescript sonarqube sonarqube-scan