0
votes

I am trying to build angular 5 App on VSTS default agent, but it fails. I used hosted agent it show version error saying it's not up to date. Is there any way to do this.

2018-01-01T19:04:36.3676392Z 17 error Windows_NT 6.3.9600 2018-01-01T19:04:36.3676620Z 18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build" "--prod" 2018-01-01T19:04:36.3676866Z 19 error node v6.9.1 2018-01-01T19:04:36.3677050Z 20 error npm v3.10.8 2018-01-01T19:04:36.3677231Z 21 error code ELIFECYCLE 2018-01-01T19:04:36.3677432Z 22 error [email protected] build:ng build 2018-01-01T19:04:36.3677619Z 22 error Exit status 1 2018-01-01T19:04:36.3677814Z 23 error Failed at the [email protected] build script 'ng build'. 2018-01-01T19:04:36.3678039Z 23 error Make sure you have the latest version of node.js and npm installed. 2018-01-01T19:04:36.3678253Z 23 error If you do, this is most likely a problem with the pet-sys package, 2018-01-01T19:04:36.3678452Z 23 error not with npm itself. 2018-01-01T19:04:36.3678673Z 23 error Tell the author that this fails on your system: 2018-01-01T19:04:36.3678861Z 23 error ng build 2018-01-01T19:04:36.3679058Z 23 error You can get information on how to open an issue for this project with: 2018-01-01T19:04:36.3679278Z 23 error npm bugs pet-sys 2018-01-01T19:04:36.3679477Z 23 error Or if that isn't available, you can get their info via: 2018-01-01T19:04:36.3679673Z 23 error npm owner ls pet-sys 2018-01-01T19:04:36.3679886Z 23 error There is likely additional logging output above. 2018-01-01T19:04:36.3680079Z 24 verbose exit [ 1, true ]'

following link contain all logs for hosted agent build

logs_597

After that I tried to use my default agent which is hosted in my server which has installed latest node and npm and I update the CAPABILITIES as follows

CAPABILITIES

then I tried to build using that agent and it show an error,

logs_602

1
What's your build definition? Can you show the whole build logs here?Marina Liu
@MarinaLiu-MSFT I have update the logsDanushka Amith Weerasingha
Can you compare the version of @angular/cli you specified in package.json matches the version you installed on build agent machine? And can you also show your app in one drive?Marina Liu
in my build agent machine and the project version are same so locally I can build but I don't know how to add that to my build agent.@MarinaLiu-MSFTDanushka Amith Weerasingha
If you can help me to create new build agent which support both node and msbuild I really appreciate.@MarinaLiu-MSFTDanushka Amith Weerasingha

1 Answers

0
votes

You should make sure the version for angular/cli package in your package.json (you are using 1.6.1) matches with the installed package in Angular cli install task (which mainly installed the latest version 1.6.3).

To double check the version you installed in VSTS agent, you can add a Command Line task after Angular cli install task. Settings for Command Line task as below:

enter image description here

If the version is really 1.6.3, you should change the angular/cli version in package.json also as 1.6.3. Then build again in VSTS.


Besides, if you build your app succeed in local machine, you can create a private agent which located in the same local machine, then remove the Angular cli install task in your VSTS build definition, and then build by the private agent, it should also build successful.

The way to create a private agent as below:

  1. Create a PAT with all scopes authorized (if you already have, then skip this step):

    In Security page (https://account.visualstudio.com/_details/security/tokens) -> Add -> input description -> Create Token -> copy the new generated token.

  2. Config agent:

    In Agent Pools page, you can create New pool -> Download agent -> unzip the download .zip file -> run powershell as Administrator -> cd /unzip/folder -> then start config a private agent:

    ./config,cmd

    # input URL (https://account.visualstudio.com), PAT, agent pool name as the command hints

  3. Check if the new agent you created is online:

    In Agent Pools page -> select the new created -> check if it’s online -> If offline -> input ./run.cmd in powershell window.

More details about config private agent, you can refer Deploy an agent on Windows.