当我尝试从我的机器上运行示例jenkins项目时。但是,我不会在本地构建我的项目。
我概述了设置in this jing video
我做错了什么? 我应该使用哪些具体步骤来修复它。
詹金斯的错误消息
Started by user Jacqueline George
Building in workspace /Users/jacquelinegeorge/.jenkins/$(JENKINS_HOME)/LocatorTraining
[LocatorTraining] $ cmd /c call /var/folders/2s/d8lh31wd3_7dx65htqzvpcv80000gn/T/jenkins6260102670441278278.bat
FATAL: command execution failed
java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:248)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
Caused: java.io.IOException: Cannot run program "cmd" (in directory "/Users/jacquelinegeorge/.jenkins/$(JENKINS_HOME)/LocatorTraining"): error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at hudson.Proc$LocalProc.<init>(Proc.java:249)
at hudson.Proc$LocalProc.<init>(Proc.java:218)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:935)
at hudson.Launcher$ProcStarter.start(Launcher.java:454)
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:744)
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:1819)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE
构建配置
我如何执行构建
在外壳中使用npm run量角器后的代码
Started by user Jacqueline George
Building in workspace /Users/jacquelinegeorge/.jenkins/$(JENKINS_HOME)/LocatorTraining
[LocatorTraining] $ /bin/sh -xe /var/folders/2s/d8lh31wd3_7dx65htqzvpcv80000gn/T/jenkins563599888073808645.sh
+ npm run protractor
npm ERR! path /Users/jacquelinegeorge/.jenkins/$(JENKINS_HOME)/LocatorTraining/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/Users/jacquelinegeorge/.jenkins/$(JENKINS_HOME)/LocatorTraining/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/jacquelinegeorge/.npm/_logs/2018-11-13T10_38_04_562Z-debug.log
Build step 'Execute shell' marked build as failure
Finished: FAILURE
我对构建进行了修改。我选择了“ shell”(因为我是mac用户)而不是Windows批处理(按照我的老师的指示)。我还从配置中删除了客户工作区
在“ build”中添加了以下命令
/用户/ JacquelineGeorge / Documents / Jenkins / LocatorTraining && npm run 量角器
它仍然失败,但是此消息至少有所不同。
在
下使用${JENKINS_HOME}
和不使用Building in workspace /Users/jacquelinegeorge/.jenkins/workspace/Protractor
[Protractor] $ /bin/sh -xe /var/folders/2s/d8lh31wd3_7dx65htqzvpcv80000gn/T/jenkins8556486662152409824.sh
+ /Users/jacquelinegeorge/Documents/Jenkins/LocatorTraining
/var/folders/2s/d8lh31wd3_7dx65htqzvpcv80000gn/T/jenkins8556486662152409824.sh: line 2: /Users/jacquelinegeorge/Documents/Jenkins/LocatorTraining: is a directory
Build step 'Execute shell' marked build as failure
Finished: FAILURE
的情况下,我也都尝试过
常规>高级>使用自定义工作区
{{1}}
答案 0 :(得分:2)
失败是由于您选择Execute window batch command
的构建步骤。但是您的Jenkins从属机器(测试脚本所在的地方)是Linux。
对于该构建步骤,您应该选择Execute shell
。
答案 1 :(得分:0)
好,我将对此对话进行总结。
从项目页面中选择configure
向下滚动到build
在构建中,选择shell
输入cd /Users/YourUserNameHere/YourProjectWorkSpace/ProjectFolder/FileName&&npm run protractor
Save
单击立即生成时。现在,您的项目应该在计算机上本地构建。