1

I installed Jenkins and started and configured my sample Cordova project with it. I created a multi - configuration project, where my Configure page contains following details.

  1. Multi-configuration project name : Phonegap
  2. Github Project URL :
  3. Source Code Management : Git Repositories : Repository URL :
  4. Build Triggers Poll SCM where Schedule time is :H/5 ****
  5. Configuration Matrix Name : Platforms Values: windows android
  6. Build Command : cd ProjectName cordova platform add $PLATFORM cordova build

and I appiled Save Now, when I create a build it failed with two platforms Configurations Windows and Android when to clicked on each platform Failed build says:

 C:\Program Files (x86)\Jenkins\workspace\Phonegap\PLATFORM\windows>cd HelloWorldCordova 

 C:\Program Files (x86)\Jenkins\workspace\Phonegap\PLATFORM\windows\XXXCordova>cordova platform add $PLATFORM 
'cordova' is not recognized as an internal or external command,
operable program or batch file.

 C:\Program Files 
 (x86)\Jenkins\workspace\Phonegap\PLATFORM\windows\HelloWorldCordova>cordova build 
 'cordova' is not recognized as an internal or external command,
 operable program or batch file.

  C:\Program Files 
  (x86)\Jenkins\workspace\Phonegap\PLATFORM\windows\XXXCordova>exit 9009 
   Build step 'Execute Windows batch command' marked build as failure
   Finished: FAILURE

so what did I miss and what is the problem here? Default Jenkins installed in C:.

Can anyone help me how to proceed with such problem? And what are things needs to configure yet?

vvvvv
  • 25,404
  • 19
  • 49
  • 81
Swift
  • 271
  • 3
  • 13

1 Answers1

1

It seems that npm is not added to your system's environment variables/PATH as you are getting the error message 'cordova' is not recognized as an internal or external command. NPM manages the 'cordova' command linking as far as I remember

In Windows

Start -> Control Panel -> System and Security -> System -> Environment variables

ADD the following to the end of your PATH

;C:\Users\user1\AppData\Roaming\npm

Replace user1 with the username on which the command is being executed

Semi-colon is important as it splits this entry from the last existing entry in your path, and adding to the end it is important as you don't want to break any existing tools and such that are configured in your path.

Peter Reid
  • 5,139
  • 2
  • 37
  • 33
  • **@Peter Reid** for mac machine facing this issue - /var/folders/sj/01rfz4rx1ws_smjvggb_klzw0000gq/T/jenkins5523192147979463708.sh: line 2: platform: command not found Build step 'Execute shell' marked build as failure Finished: FAILURE – Swift Apr 17 '17 at 13:02
  • @Swift for MacOS check out this answer https://stackoverflow.com/questions/14803978/npm-global-path-prefix – Peter Reid Apr 17 '17 at 13:10
  • no it's not related to it, i have added under Jenkins->Manage Jenkins->nodes->mac-slave->/usr/local/bin/cordova added this path for which cordova now it should pick it platform command from there. as my script is running fine in windows machine say android and windows facing an issue for ios only. hopeless for such error couldn't find anything related to it what configurations shall i add for it ? – Swift Apr 17 '17 at 13:28
  • Hmmm...strange, reading now it seems that it is having a problem invoking the platform command rather than the cordova command. I'd suggest opening a separate question - as this seems to be a separate issue. – Peter Reid Apr 17 '17 at 13:38
  • **@Peter Reid**: here is the url for http://stackoverflow.com/questions/43464066/platform-command-not-found-for-jenkins-for-ios-build - can you please have a look at it once ? – Swift Apr 18 '17 at 05:14