gpt4 book ai didi

node.js - 执行 npm run sonarqube-scanner-node 命令时出错

转载 作者:太空宇宙 更新时间:2023-11-04 00:19:04 26 4
gpt4 key购买 nike

在cmd中执行npm run sonarqube-scanner-node命令时出错

E:...>npm run sonarqube-scanner-node

[17:04:46] Executing sonarqube-scanner ...
node_modules\sonarqube-scanner-node\dist\sonar-scanner-3.0.3.778\bin\sonar-scann
er.bat
child_process.js:504
throw err;
^

Error: spawnSync ...\git\zara-cargo-mobile\node_modules\sonarqube
-scanner-node\dist\sonar-scanner-3.0.3.778\bin\sonar-scanner.bat ENOENT
at exports._errnoException (util.js:1018:11)
at spawnSync (child_process.js:459:20)
at execFileSync (child_process.js:496:13)
at Object. (...\git\zara-cargo-mobile\node_modules
\sonarqube-scanner-node\src\index.js:18:1)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\
node_modules\npm\bin\npm-cli.js" "run" "sonarqube"
npm ERR! node v6.11.0
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE

我还在浏览器中测试了 sonarqube-scanner-node https://www.npmjs.com/package/sonarqube-scanner-node 。它也不起作用。

Error Stack Trace Viewer
Error: spawnSync /app/available_modules/1500637668000/sonarqube-scanner-node/dist/sonar-scanner-3.0.3.778/bin/sonar-scanner ENOENT
at util._errnoException in core util.js — line 1022
at child_process.spawnSync in core child_process.js — line 461
at child_process.execFileSync in core child_process.js — line 498
in sonarqube-scanner-node/src/index.js — line 18
node.js startup…

请帮我解决这个问题。

最佳答案

我使用了 Sonar 扫描仪包并点击链接 https://www.npmjs.com/package/sonar-scanner .

我在package.json中传递了sonar-scanner.bat的完整路径(在正确的代码部分中显示)并成功运行。

代码不正确:(如文档所示)

{
"scripts": {
"sonar-scanner": "node_modules/sonar-scanner/bin/sonar-scanner"
}
}

正确代码:

 {
"scripts": {
"sonar-scanner": "node_modules/sonar-scanner/bin/sonar-scanner.bat"
}
}

关于node.js - 执行 npm run sonarqube-scanner-node 命令时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45237660/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com