Search code examples
cordovaazure-devopscode-push

CODE-PUSH error on release through VSTS


While pushing a release through code-push extension on VSTS i am getting the following error unable to know why!

enter image description here

Tried one of the below solution as adding a variable named as "Build.SourceDirectory" in your build definition and getting the following error log

enter image description here

2017-11-17T09:13:07.6795222Z npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
2017-11-17T09:13:07.6795222Z ZUMOAPPNAME@1.0.0 d:\a\3\s
2017-11-17T09:13:07.6795222Z `-- (empty)
2017-11-17T09:13:07.6795222Z npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
2017-11-17T09:13:07.6795222Z 
2017-11-17T09:13:07.6835014Z npm WARN ZUMOAPPNAME@1.0.0 No description
2017-11-17T09:13:07.8445206Z npm WARN ZUMOAPPNAME@1.0.0 No license field.
2017-11-17T09:13:07.8465194Z npm ERR! Windows_NT 10.0.14393
2017-11-17T09:13:07.8475041Z npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "cordova"
2017-11-17T09:13:07.8475041Z npm ERR! node v6.10.0
2017-11-17T09:13:07.8475041Z npm ERR! npm  v3.10.10
2017-11-17T09:13:07.8475041Z npm ERR! path d:\a\3\s\node_modules\cordova\node_modules\.bin\acorn.cmd
2017-11-17T09:13:07.8475041Z npm ERR! code EEXIST
2017-11-17T09:13:07.8475041Z 
2017-11-17T09:13:07.8475041Z npm ERR! Refusing to delete d:\a\3\s\node_modules\cordova\node_modules\.bin\acorn.cmd: ..\acorn\bin\acorn symlink target is not controlled by npm d:\a\3\s\node_modules\cordova\node_modules\acorn
2017-11-17T09:13:07.8475041Z npm ERR! File exists: d:\a\3\s\node_modules\cordova\node_modules\.bin\acorn.cmd
2017-11-17T09:13:07.8475041Z npm ERR! Move it away, and try again.
2017-11-17T09:13:07.8475041Z 
2017-11-17T09:13:07.8475041Z npm ERR! Please include the following file with any support request:
2017-11-17T09:13:07.8475041Z npm ERR!     d:\a\3\s\Client Components\Main\Source\vr9-11\npm-debug.log
2017-11-17T09:13:07.8475041Z npm ERR! code 1
2017-11-17T09:13:07.9305055Z ##[debug]load strings from: d:\a\_tasks\CodePushReleaseCordova_f5990527-f512-4c14-9f8e-1254240dc3cb\1.0.5\node_modules\vsts-task-lib\lib.json
2017-11-17T09:13:07.9325060Z Unhandled: Command failed: npm install cordova
2017-11-17T09:13:07.9325060Z ##[debug]load loc strings from: d:\a\_tasks\CodePushReleaseCordova_f5990527-f512-4c14-9f8e-1254240dc3cb\1.0.5\node_modules\vsts-task-lib\Strings\resources.resjson\en-US\resources.resjson
2017-11-17T09:13:07.9325060Z ##[debug]task result: Failed
2017-11-17T09:13:07.9365053Z ##[debug]Processed: ##vso[task.complete result=Failed;]Unhandled: Command failed: npm install cordova

The log file can be seen at the following link: https://drive.google.com/open?id=1OC49xlDOEQekO9gqdrj0NQCMPz8onTRX

Tried the solution suggested by Eddie(removing files of bower and node modules as they are regenerated while building) and got the following error.

2017-11-21T06:39:48.8214252Z ##[debug]Finished Building Command: node d:\a\_tasks\CodePushReleaseCordova_f5990527-f512-4c14-9f8e-1254240dc3cb\1.0.5\node_modules\code-push-cli\script\cli release-cordova "Syngenta_Visit_Report1" "android" --deploymentName "Staging" --rollout "100%"
2017-11-21T06:39:48.8254247Z ##[debug]Attempting execution of command: node d:\a\_tasks\CodePushReleaseCordova_f5990527-f512-4c14-9f8e-1254240dc3cb\1.0.5\node_modules\code-push-cli\script\cli release-cordova "Syngenta_Visit_Report1" "android" --deploymentName "Staging" --rollout "100%"
2017-11-21T06:39:49.6774368Z Running "cordova prepare" command:
2017-11-21T06:39:49.6774368Z 
2017-11-21T06:39:49.6874306Z 'cordova' is not recognized as an internal or external command,
2017-11-21T06:39:49.6904319Z operable program or batch file.
2017-11-21T06:39:49.6924371Z [Error]  Unable to prepare project. Please ensure that this is a Cordova project and that platform "android" was added with "cordova platform add android"
2017-11-21T06:39:49.7014305Z ##[debug]Finished Building Command: node d:\a\_tasks\CodePushReleaseCordova_f5990527-f512-4c14-9f8e-1254240dc3cb\1.0.5\node_modules\code-push-cli\script\cli logout
2017-11-21T06:39:50.5584321Z ##[debug]task result: Failed
2017-11-21T06:39:50.5624318Z ##[debug]Processed: ##vso[task.complete result=Failed;]Command failed: release-cordova
2017-11-21T06:39:50.5624318Z Command failed: release-cordova

The Following error while trying for Eddie's solution


Solution

  • First make sure that the folder you check in does not have any files inside node_modules folder, presence of which the hosted agent may not be able to delete the files and the tasks fails The hosted agent will download the files needed on it's own by checking the JSON files.

    In order to trouble shooting for this error: Please add two tasks before CodePush task:

    1) Add npm task with this setting

    https://drive.google.com/open?id=1H4bWAMruzfOs90xOLxgjadAd7DihaVH4

    2)After npm task, add Command Line task with below setting

    https://drive.google.com/open?id=1bxd54kVgW4zGRwhsH_JKz_cjc1wYZ-No

    Then check if the Cordova command can execute correctly

    Then if you have specified the variable Build.SourceDirectory

    as $(Build.SourcesDirectory)\path to your app

    remove it (the variable) as you have already specified the path in GET SOURCES

    You do not need to add the “Build.SourceDirectory” variable in this condition. And now, you specified the working directory to “d:\a\3\s\app path” which should not exist on the build agent, but the task didn’t report that error.

    The task indicated that it cannot find the config.xml since the file exist under “d:\a\3\s” rather than “d:\a\3\s\app path”.

    Thus remove the “Build.SourceDirectory” variable and run the build to check

    The above steps should work for the given problem

    Thanks Eddie Chen for the help