Identifying why Node.js v10 is used despite v16 being installed

Mhh…currently running into an issue with a self-hosted build agent where the Node.js tool installer task installs v16 and adds it to the PATH but still in the next task node v10 is being used. Any ideas why that is?

2024-06-06T08:32:43.3320131Z ##[debug]new Path: C:\azureagent\agent\_work\_tool\node\16.20.2\x64;C:\azureagent\agent\externals\git\cmd;C:....

...

2024-06-06T08:32:43.5450467Z ##[debug]Using node path: C:\azureagent\agent\externals\node10\bin\node.exe
2024-06-06T08:32:44.0886694Z ##[debug]agent.TempDirectory=C:\azureagent\agent\_work\_temp
2024-06-06T08:32:44.1909383Z ##[debug]loading inputs and endpoints```

Isn’t that the version of node used for the execution of the task code itself? I don’t think that’s directly affected by the tool installer. If you execute node yourself in the next task I would expect that execution to use node16.

Oh yeah, I got confused for a moment by this. Guess we need to use the variable AGENT_USE_NODE to execute tasks with a version of node that is still supported :see_no_evil:

And pray that the task supports running in node16 :stuck_out_tongue:

if the task had been updated for node16 it would have a node16 execution target and would use it by default: https://devblogs.microsoft.com/devops/node-runner-update-guidance-for-azure-pipelines-task-authors/

Ah right, it should use node16 automatically, then unless the build agent is out of date and doesn’t contain the node16 task runner, right?

The task is node16-ready

Mhm then I would expect that the node16 target is used, unless the agent is very old

According to that blog post agent versions containing node10 should not even be available anymore

mh…agent version is 3.240.1 and it is using node10 still :thinking_face:

This agent doesn’t happen to have a capability or environment variable set from a long time ago to force the use of node10?

Apparently if you use the default agent installer source it does still include node10, as well as node6. They created an alternative package that only includes node16 and node20: https://github.com/microsoft/azure-pipelines-agent/blob/master/docs/node6.md

This agent doesn’t happen to have a capability or environment variable set from a long time ago to force the use of node10?
not sure…

If the agent is old enough you may have at some point set config somewhere to force node10 instead of node6 :sweat_smile:

I think that should show up in the agent capabilities though