geeklearningio / gl-vsts-tasks-yarn

Yarn Package Manager Visual Studio Team Services Build and Release Management extensions
MIT License
52 stars 18 forks source link

Task seems to be running an old yarn version #7

Closed Markus-ipse closed 7 years ago

Markus-ipse commented 7 years ago

When running the yarn task on VSTS the builds seem to fail sporadically due to problems with @types packages, this is supposed to be fixed in Yarn 0.16.x, and brief look at your code gives me the impression that the task should be using the latest version, but looking through the logs of the failing build I can see the following line:

2017-01-18T12:57:47.8477202Z yarn install v0.15.1

Any idea as to why the task would end up using an old version of yarn, or more importantly do you have any insight into how one would go about fixing it?

sandorfr commented 7 years ago

Hi @Markus-ipse,

Thanks for the feedback. The bundled version is 0.18.1. I plan to update to 0.19.1 soon . However, if there is a yarn in path it will use the version in path. My guess is that you have an older version of yarn installed on your build agent.

What can be done on your side is remove or upgrade your yarn install.

What I can do is add an option to force using the bundled version.

Additional info : If you check your debug logs see you will probably see something like this :

2017-01-08T16:09:40.2776649Z ##[debug]yarn=C:\Users\buildadmin\AppData\Roaming\npm\yarn.cmd
2017-01-08T16:09:40.2776649Z ##[debug]Arguments=null
2017-01-08T16:09:40.2776649Z ##[debug]ProjectDirectory=C:\gl-vso-agent-core\_work\16\s\src\SampleNode
2017-01-08T16:09:40.2776649Z ##[debug]C:\Users\buildadmin\AppData\Roaming\npm\yarn.cmd
2017-01-08T16:09:40.2776649Z ##[debug]ProductionMode=false
2017-01-08T16:09:40.2776649Z ##[debug]exec tool: C:\Users\buildadmin\AppData\Roaming\npm\yarn.cmd
2017-01-08T16:09:40.2776649Z ##[debug]Arguments:
2017-01-08T16:09:40.2776649Z [command]C:\Users\buildadmin\AppData\Roaming\npm\yarn.cmd
2017-01-08T16:09:40.5589049Z yarn install v0.15.1

instead of

2017-01-18T13:36:08.1522361Z ##[debug]yarn=null
2017-01-18T13:36:08.1522361Z ##[debug]Arguments=null
2017-01-18T13:36:08.1522361Z ##[debug]ProjectDirectory=C:\a\1\s\src\SampleNode
2017-01-18T13:36:08.1522361Z ##[debug]AGENT_WORKFOLDER=C:\a
2017-01-18T13:36:19.8144429Z ##[debug]C:\a\yarn
2017-01-18T13:36:19.8144429Z ##[debug]["dist"]
2017-01-18T13:36:19.8154426Z ##[debug]C:\a\yarn\dist\bin\yarn.cmd
2017-01-18T13:36:19.8154426Z ##[debug]ProductionMode=false
2017-01-18T13:36:19.8164445Z ##[debug]exec tool: C:\a\yarn\dist\bin\yarn.cmd
2017-01-18T13:36:19.8164445Z ##[debug]Arguments:
2017-01-18T13:36:19.8164445Z [command]C:\a\yarn\dist\bin\yarn.cmd
2017-01-18T13:36:21.0329970Z yarn install v0.18.1
Markus-ipse commented 7 years ago

Removing and then adding the yarn extension again in VSTS solved the problem! 🎉

sandorfr commented 7 years ago

This is weird :( let us know and provide detailed traces if it ever happens again 👍

Markus-ipse commented 7 years ago

@sandorfr Here's an excerpt of the logs from when it was failing, if it's of any help

2017-01-18T12:57:47.0039765Z Set workingFolder to default: C:\agent\tasks\Yarn\0.3.999
2017-01-18T12:57:47.3321018Z ##[debug]agent.workFolder=C:\agent\_work
2017-01-18T12:57:47.3321018Z ##[debug]loading inputs and endpoints
2017-01-18T12:57:47.3321018Z ##[debug]loading ENDPOINT_AUTH_[...]
2017-01-18T12:57:47.3321018Z ##[debug]loading ENDPOINT_AUTH_[...]
2017-01-18T12:57:47.3321018Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
2017-01-18T12:57:47.3321018Z ##[debug]loading ENDPOINT_AUTH_SCHEME_[...]
2017-01-18T12:57:47.3321018Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
2017-01-18T12:57:47.3321018Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
2017-01-18T12:57:47.3321018Z ##[debug]loading INPUT_PRODUCTIONMODE
2017-01-18T12:57:47.3321018Z ##[debug]loading INPUT_PROJECTDIRECTORY
2017-01-18T12:57:47.3321018Z ##[debug]loaded 8
2017-01-18T12:57:47.3789754Z ##[debug]Absolute path for pathSegments: C:\agent\agent\worker\Modules\Microsoft.TeamFoundation.DistributedTask.Task.Internal\NativeBinaries\amd64/yarn = C:\agent\agent\worker\Modules\Microsoft.TeamFoundation.DistributedTask.Task.Internal\NativeBinaries\amd64\yarn
2017-01-18T12:57:47.3789754Z ##[debug]Absolute path for pathSegments: C:\Windows\system32/yarn = C:\Windows\system32\yarn
2017-01-18T12:57:47.3789754Z ##[debug]Absolute path for pathSegments: C:\Windows/yarn = C:\Windows\yarn
2017-01-18T12:57:47.3789754Z ##[debug]Absolute path for pathSegments: C:\Windows\System32\Wbem/yarn = C:\Windows\System32\Wbem\yarn
2017-01-18T12:57:47.3789754Z ##[debug]Absolute path for pathSegments: C:\Windows\System32\WindowsPowerShell\v1.0\/yarn = C:\Windows\System32\WindowsPowerShell\v1.0\yarn
2017-01-18T12:57:47.3789754Z ##[debug]Absolute path for pathSegments: C:\Program Files\Git\bin\/yarn = C:\Program Files\Git\bin\yarn
2017-01-18T12:57:47.3789754Z ##[debug]Absolute path for pathSegments: C:\Program Files\Microsoft\Web Platform Installer\/yarn = C:\Program Files\Microsoft\Web Platform Installer\yarn
2017-01-18T12:57:47.3789754Z ##[debug]Absolute path for pathSegments: C:\Program Files\Microsoft SQL Server\120\Tools\Binn\/yarn = C:\Program Files\Microsoft SQL Server\120\Tools\Binn\yarn
2017-01-18T12:57:47.3789754Z ##[debug]Absolute path for pathSegments: C:\NPM\Modules/yarn = C:\NPM\Modules\yarn
2017-01-18T12:57:47.3789754Z ##[debug]yarn=C:\NPM\Modules\yarn.cmd
2017-01-18T12:57:47.3789754Z ##[debug]Arguments=null
2017-01-18T12:57:47.3789754Z ##[debug]ProjectDirectory=C:\agent\_work\15\s
2017-01-18T12:57:47.3789754Z ##[debug]C:\NPM\Modules\yarn.cmd
2017-01-18T12:57:47.3789754Z ##[debug]ProductionMode=false
2017-01-18T12:57:47.3789754Z ##[debug]exec tool: C:\NPM\Modules\yarn.cmd
2017-01-18T12:57:47.3789754Z ##[debug]Arguments:
2017-01-18T12:57:47.3945952Z [command]C:\NPM\Modules\yarn.cmd
2017-01-18T12:57:47.8477202Z yarn install v0.15.1
2017-01-18T12:57:48.1445864Z [1/4] Resolving packages...
2017-01-18T12:57:48.6602035Z [2/4] Fetching packages...
2017-01-18T12:57:51.0039237Z warning fsevents@1.0.17: The platform "win32" is incompatible with this module.
2017-01-18T12:57:51.0039237Z info "fsevents@1.0.17" is an optional dependency and failed compatibility check. Excluding it from installation.
2017-01-18T12:57:51.0195584Z warning benchmark@1.0.0: The engine "rhino" appears to be invalid.
2017-01-18T12:57:51.0351777Z [3/4] Linking dependencies...
2017-01-18T12:57:51.0508030Z warning Unmet peer dependency "electron-prebuilt@>=0.35.0".
2017-01-18T12:57:51.0508030Z warning Incorrect peer dependency "d3@4.4.0".
2017-01-18T12:57:51.0508030Z warning Incorrect peer dependency "rxjs@5.0.1".
2017-01-18T12:57:51.0508030Z warning Unmet peer dependency "@angular/tsc-wrapped@^0.5.0".
2017-01-18T12:57:51.0508030Z warning Unmet peer dependency "reflect-metadata@^0.1.8".
2017-01-18T12:57:51.0508030Z warning Incorrect peer dependency "webpack@2.2.0-rc.3".
2017-01-18T12:58:02.3318434Z error ENOENT: no such file or directory, open 'C:\agent\_work\15\s\node_modules\@types\auth0-js\index.d.ts'
2017-01-18T12:58:02.3318434Z     at Error (native)
2017-01-18T12:58:02.3318434Z info Visit http://yarnpkg.com/en/docs/cli/install for documentation about this command.
2017-01-18T12:58:02.3787163Z ##[debug]rc:1
2017-01-18T12:58:02.3787163Z ##[debug]success:false
2017-01-18T12:58:02.3787163Z ##[debug]task result: Failed
2017-01-18T12:58:02.3943418Z ##[error]Error: C:\NPM\Modules\yarn.cmd failed with return code: 1
2017-01-18T12:58:02.3943418Z Error: C:\NPM\Modules\yarn.cmd failed with return code: 1
sandorfr commented 7 years ago

Thanks,

Are you using your own agent or an hosted agent? I'm asking this question because yarn was found in C:\NPM\Modules\yarn.cmd path according to logs and I've never used this in the past nor have I noticed this on hosted agents.

Markus-ipse commented 7 years ago

We have both our own and hosted agents, I just went over the logs of all the failing builds and it turns out that they were all on our own agent, and it looks like it might have been switching over to use hosted agents instead that solved the problem.

So probably removing and re-adding the extension just happened at about the same time in the frenzy of trying different things to get the builds working again, and I misattributed it as the solution.

sandorfr commented 7 years ago

ah :) the infamous trial and error frenzy !