Problem:
I want to use the cURL task in VSO build but when I try I
get the following error:
There are issues with the request
or definition that may prevent the
build from running:
No agent could be found with the following capabilities: npm, curl
Queue the build anyway?
Solution:
Stand up your own agent and install cURL yourself.
Explanation:
The hosted build agents provided by VSO Build do not have
the ability or, in VSO build terms, the capability to run all of the tasks we
provide out of the box. Each task has
the option to define demands. Demands are capabilities that must exist on an
agent before that task can be executed.
When you add the cURL task to your build definition, it also adds a curl
demand. If you review the capabilities
of the hosted build agents, you will notice that curl is not listed. Therefore,
if you attempt to queue a build against our hosted build agents, you will get
an error.
The solution is to simply stand up your own agent and
install the needed tools. You can learn
how to download and configure an agent here.
The agent can be installed on any
machine that can reach VSO.
Installing cURL is not as
easy as it should be; if you use Chocolatey,
life is much easier. But before you can use
Chocolatey to install cURL, you have to install Chocolatey. Luckily, installing Chocolatey is very
easy. Simply copy and paste the string
below into an administrative command prompt.
@powershell -NoProfile -ExecutionPolicy Bypass -Command
"iex ((new-object
net.webclient).DownloadString('https://chocolatey.org/install.ps1'))"
&& SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
Once that command completes, you can simply type the
following command to install cURL:
choco install curl
Unfortunately, that is not enough. At this point, we have cURL on the machine but
our agent is still unaware that it has this new capability. We need to register the capability on the
agent. You can read how to do that in my
blog post here. Just ensure the capability is registered to
match the demand in the error message. In this example with cURL, the
capability is curl.
Once the capability is registered, restart your agent. If
you are running your agent in interactive mode, I suggest you close and reopen
a new command prompt. If you are running
as a service, simply restarting the service will work.