【问题标题】:do anyone know what this log output mean有谁知道这个日志输出是什么意思
【发布时间】:2020-01-01 11:32:26
【问题描述】:

我正在尝试使用 jenkins 对浏览器运行自动化测试,我正在使用 webdriverIO 框架。 当我使用命令提示符时它可以工作,但是当使用 jekins 触发作业时,我收到一个错误,我认为这与 jenkins 执行 shell 功能有关,

我已经下载了 nodejs 插件并将 jenkins 设置为使用自定义工作区:C:/Users/Dell/Desktop/WebDriverio/node_modules/.bin

在我输入的 shell 命令中:

npm 安装 npm 测试

喜欢这个维基:https://wiki.jenkins.io/display/JENKINS/NodeJS+Plugin

在 jenkins 系统配置中,我使用程序文件中的 npm bin 文件的路径填充了环境变量字段

这是日志输出:

Running as SYSTEM
Building in workspace C:/Users/Dell/Desktop/WebDriverio/node_modules/.bin
[.bin] $ sh -xe C:\Users\Dell\AppData\Local\Temp\jenkins4703594410706272745.sh
The system cannot find the file specified
FATAL: command execution failed
java.io.IOException: CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessImpl.create(Native Method)
    at java.lang.ProcessImpl.<init>(Unknown Source)
    at java.lang.ProcessImpl.start(Unknown Source)
Caused: java.io.IOException: Cannot run program "sh" (in directory "C:\Users\Dell\Desktop\WebDriverio\node_modules\.bin"): CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessBuilder.start(Unknown Source)
    at hudson.Proc$LocalProc.<init>(Proc.java:250)
    at hudson.Proc$LocalProc.<init>(Proc.java:219)
    at hudson.Launcher$LocalLauncher.launch(Launcher.java:937)
    at hudson.Launcher$ProcStarter.start(Launcher.java:455)
    at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:109)
    at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:66)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741)
    at hudson.model.Build$BuildExecution.build(Build.java:206)
    at hudson.model.Build$BuildExecution.doRun(Build.java:163)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
    at hudson.model.Run.execute(Run.java:1853)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:427)
Build step 'Execute shell' marked build as failure
Finished: FAILURE

提前谢谢你

【问题讨论】:

  • 我也遵循了这些说明webdriver.io/docs/jenkins.html
  • 当你npm install 项目的node_modules 目录下应该有一个.bin 文件夹...请确认它在那里
  • 是的,它就在那里,当我在 windows powershell 上执行 ./node_modules/.bin/wdio wdio.conf.js 时它可以工作
  • 也许 sh 是一个 linux shell 命令或缺少依赖项(我没有使用 Jenkins 的经验)
  • 好的,没问题,谢谢。

标签: jenkins wdio-v5


【解决方案1】:

要在 Windows 机器上运行脚本,您需要使用 Execute Windows batch command 而不是 Execute shell,除非您使用 Cygwin,这是另一回事。

【讨论】:

  • 感谢您的回答,但问题是当我尝试在工作中的 Windows 10 虚拟机上执行此操作时,它运行良好,而且我还注意到来自 jenkins 方面的所有 wiki 或wdio 方面只在执行 shell 构建步骤中进行对话
  • 显然您工作的虚拟机正在运行 Cygwin、MKS Toolkit 或 Windows 的 Linux 子系统 (WSL),所有这些都提供了一个兼容层,可以在 Windows 上运行类似 Unix 的脚本。
猜你喜欢
  • 2014-03-31
  • 1970-01-01
  • 2017-12-29
  • 2013-11-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-03-05
相关资源
最近更新 更多