通过VSTS发布时出现CODE-PUSH错误

时间:2017-11-08 09:31:29

标签: cordova azure-devops code-push

在通过VSTS上的代码推送扩展推送版本时,我收到以下错误无法知道原因!

enter image description here

尝试在下面的解决方案之一中添加一个名为“Build.SourceDirectory”的变量,并在构建定义中获取以下错误日志

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

可以在以下链接中看到日志文件:https://drive.google.com/open?id=1OC49xlDOEQekO9gqdrj0NQCMPz8onTRX

尝试了Eddie建议的解决方案(删除了bower和节点模块的文件,因为它们在构建时重新生成)并出现以下错误。

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

2 个答案:

答案 0 :(得分:1)

该任务从Build.SourcesDirectory文件夹的根目录运行“cordova prepare”命令,如“d:\ a \ 3 \ s”。我怀疑你的代码文件放在像“d:\ a \ 3 \ s \ yourappname”这样的子文件夹中,导致命令无法找到项目。但是,没有任何选项可以在任务中指定项目目录。

作为一种变通方法,您可以在构建定义中添加名为“Build.SourceDirectory”的变量,如下所示: enter image description here

答案 1 :(得分:0)

首先确保您签入的文件夹中没有node_modules文件夹中的任何文件,托管代理可能无法删除文件并且任务失败托管代理将自行下载所需的文件通过检查JSON文件。

为了解决此错误:请在CodePush任务之前添加两个任务:

1)使用此设置添加npm任务

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

2)在npm任务之后,使用以下设置添加命令行任务

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

然后检查Cordova命令是否可以正确执行

然后,如果您已指定变量Build.SourceDirectory

作为$(Build.SourcesDirectory)\你的应用程序的路径

删除它(变量),因为您已经在GET SOURCES中指定了路径

在这种情况下,您无需添加“Build.SourceDirectory”变量。现在,您将工作目录指定为“d:\ a \ 3 \ s \ app path”,它不应存在于构建代理上,但该任务未报告该错误。

该任务表明找不到config.xml,因为该文件存在于“d:\ a \ 3 \ s”而不是“d:\ a \ 3 \ s \ app path”下。

因此删除“Build.SourceDirectory”变量并运行构建以检查

以上步骤适用于给定的问题

感谢Eddie Chen的帮助