Caused java io IOException Cannot run program sh in directory D myjenkins workspace cal CreateProcess error 2 The system cannot find the file specified

+1 vote

Hi Guys,

I am trying to run one job in my Jenkins cluster. But I got this below error.

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)
Also:   hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from 192.168.99.1/192.168.99.1:57126
  at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1788)
  at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:356)
  at hudson.remoting.Channel.call(Channel.java:998)
  at hudson.Launcher$RemoteLauncher.launch(Launcher.java:1057)
  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: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:1856)
  at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
  at hudson.model.ResourceController.execute(ResourceController.java:97)
  at hudson.model.Executor.run(Executor.java:428)
Caused: java.io.IOException: Cannot run program "sh" (in directory "D:\myjenkins\workspace\cal"): CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(Unknown Source)
at hudson.Proc$LocalProc.<init>(Proc.java:252)
at hudson.Proc$LocalProc.<init>(Proc.java:221)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:936)
at hudson.Launcher$ProcStarter.start(Launcher.java:454)
at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1316)
at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1269)
at hudson.remoting.UserRequest.perform(UserRequest.java:211)
at hudson.remoting.UserRequest.perform(UserRequest.java:54)
at hudson.remoting.Request$2.run(Request.java:369)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:117)
at java.lang.Thread.run(Unknown Source)
Build step 'Execute shell' marked build as failure
Finished: FAILURE
May 29, 2020 in Jenkins by akhtar
• 38,260 points
19,381 views
Спасибо за пост

1 answer to this question.

0 votes

Hi@akhtar,

You got this error because the commands are not supported in your Jenkins node. Let's discuss this with an example.

Say, you have created one Jenkins Cluster. This cluster has three nodes, two Linux system and one windows system. Now create one job and try to run ls command. When this job runs on Linux system, it will work fine. But if this job runs on windows system, then it will give an error, because windows does not support ls command.

To avoid this error we can create labels in our nodes and then run Jenkins job accordingly.

Hope this will help.

answered May 29, 2020 by MD
• 95,460 points

Related Questions In Jenkins

0 votes
1 answer
0 votes
1 answer

An error “Unable to create the home directory ‘JENKINS_HOME’”

This is most probably a permission problem. You ...READ MORE

answered Jul 19, 2018 in Jenkins by Kalgi
• 2,680 points
3,498 views
0 votes
3 answers

Error: ‘Jenkins: Cannot define variable in pipeline stage’

https://stackoverflow.com/questions/39832862/jenkins-cannot-define-var ...READ MORE

answered Mar 13, 2019 in Jenkins by Charles Wu
5,082 views
+1 vote
3 answers

"No such file pom.xml" error in Jenkins

Can you please che ck the location ...READ MORE

answered May 16, 2019 in Jenkins by Samir
21,707 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,995 views
+2 votes
1 answer
0 votes
1 answer

What is the difference between the Jenkins jobs which are in workspace directory and jobs directory

Hi@Shashi, These folders have different meanings in Jenkins. If ...READ MORE

answered Oct 21, 2020 in Jenkins by MD
• 95,460 points
3,953 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP