gulp
command with locally installed gulp on Azure Pipelines using a self-hosted agentI encountered the same issue as @RSW. I was using Azure Pipelines with a self hosted agent. My pipeline installed gulp v4.0.2
locally for my project.
ref: @RSW's comment under this answer
Not good solution for my case. I am using azure pipelines with self hosted agent. I don't want to install the gulp globally because different projects may require different versions of gulp. What options do I have? Please help
Instead of using Azure Pipelines' built-in gulp task, such as:
- task: gulp@1
displayName: 'Run gulp tasks'
...which, in my case, generated the following error:
##[error]Unhandled: Unable to locate executable file: 'gulp'.
You can use this alternative approach:
- script: './node_modules/.bin/gulp'
displayName: 'Run gulp tasks'
script:
Remember that not all build activities map to a built-in task. For example, there's no built-in task that runs the node-Sass utility, or writes build info to a text file. To run general system commands, you use the
CmdLine@2
orscript
task. The pipeline uses thescript
task because it's a common shortcut forCmdLine@2
.
The local Node package folder (node_module/
), where your self-hosted agent installs packages for a pipeline run, is likely located at a path like: C:\agents\_work\2\s\node_modules\
(on my Windows machine).
Here, C:\agents\_work\2\s\
contains the project files for that specific pipeline run. *Note that this path may vary between different pipeline runs.