npm 错误!代码 ELIFECYCLE - 从 jenkins 运行 webdriver IO 测试

Posted

技术标签:

【中文标题】npm 错误!代码 ELIFECYCLE - 从 jenkins 运行 webdriver IO 测试【英文标题】:npm ERR! code ELIFECYCLE - Running webdriver IO tests from jenkins 【发布时间】:2021-12-03 09:02:48 【问题描述】:

我在 jenkins 中使用 allure 集成运行 webdriverIO 测试,测试完成后它显示 npm ERR!代码 ELIFECYCLE 后跟 'java.lang.NullPointerException 在 ru.yandex.qatools.allure.jenkins.AllureReportPublisherDescriptor.getCommandlineInstallation(AllureReportPublisherDescriptor.java:112)'

已尝试清除 npm 缓存、删除 node_modules、npm 安装。

Spec Files:  5 passed, 1 failed, 6 total (100% completed) in 00:00:57 
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! webdriverio7@1.0.0 creditCardTests: `npx wdio run wdio.conf.js -- suite creditCard`
    npm ERR! Exit status 1
    npm ERR! 
    npm ERR! Failed at the webdriverio7@1.0.0 creditCardTests script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     C:\Users\ak\AppData\Roaming\npm-cache\_logs\2021-10-15T04_16_36_501Z-debug.log
    Build step 'Execute Windows batch command' marked build as failure
    ERROR: Build step failed with exception
    java.lang.NullPointerException
        at ru.yandex.qatools.allure.jenkins.AllureReportPublisherDescriptor.getCommandlineInstallation(AllureReportPublisherDescriptor.java:112)
        at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.getCommandline(AllureReportPublisher.java:346)
        at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.generateReport(AllureReportPublisher.java:303)
        at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.perform(AllureReportPublisher.java:231)
        at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
        at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:78)
        at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
        at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:806)
        at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:755)
        at hudson.model.Build$BuildExecution.post2(Build.java:178)
        at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:699)
        at hudson.model.Run.execute(Run.java:1913)
        at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
        at hudson.model.ResourceController.execute(ResourceController.java:99)
        at hudson.model.Executor.run(Executor.java:432)
    Build step 'Allure Report' marked build as failure
    Finished: FAILURE

【问题讨论】:

【参考方案1】:

删除了 allure 插件并再次添加了 maven 链接以获取插件。

我能够生成诱惑报告,但仍然收到旧错误...npm ERR!代码生命周期

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! webdriverio7@1.0.0 creditCardTests: `npx wdio run wdio.conf.js -- suite creditCard`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the webdriverio7@1.0.0 creditCardTests script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\arukumar\AppData\Roaming\npm-cache\_logs\2021-10-15T10_43_02_186Z-debug.log
Build step 'Execute Windows batch command' marked build as failure
[webdriverio7] $ C:\Users\arkumar\.jenkins\tools\ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation\allure\bin\allure.bat generate D:\webdriverio7\allure-results -c -o D:\webdriverio7\allure-report
Report successfully generated to D:\webdriverio7\allure-report
Allure report was successfully generated.
Creating artifact for the build.
Artifact was added to the build.
Finished: FAILURE

【讨论】:

你确定你已经安装了@wdio/cli 还是把它作为依赖的一部分?

以上是关于npm 错误!代码 ELIFECYCLE - 从 jenkins 运行 webdriver IO 测试的主要内容,如果未能解决你的问题,请参考以下文章

如何修复节点服务器错误,npm ERR!代码 ELIFECYCLE npm 错误!错误1?

React app not Building 显示代码 ELIFECYCLE

错误的ERR!代码ELIFECYCLE错误1当npm安装在模块上时

“vue-cli-service test:unit” 运行成功;但 npm 退出错误代码 1 ELIFECYCLE

运行 npm start 时出现“index.js not found”,错误!代码 ELIFECYCLE 和 ENOENT

在节点 js“应该设置秘密”和反应“npm ERR!代码 ELIFECYCLE”中出现错误