UseNode@1 - 使用 Node.js 生态系统 v1 任务

使用此任务查找、下载和缓存指定版本的 Node.js 并将其添加到 PATH。 此任务还提供代理支持。

语法

# Use Node.js ecosystem v1
# Set up a Node.js environment and add it to the PATH, additionally providing proxy support.
- task: UseNode@1
  inputs:
    #version: '10.x' # string. Version. Default: 10.x.
    #checkLatest: false # boolean. Check for Latest Version. Default: false.
    #force32bit: false # boolean. Use 32 bit version on x64 agents. Default: false.
  # advanced
    #retryCountOnDownloadFails: '5' # string. Set retry count when nodes downloads failed. Default: 5.
    #delayBetweenRetries: '1000' # string. Set delay between retries. Default: 1000.
# Use Node.js ecosystem v1
# Set up a Node.js environment and add it to the PATH, additionally providing proxy support.
- task: UseNode@1
  inputs:
    #version: '10.x' # string. Version. Default: 10.x.
    #checkLatest: false # boolean. Check for Latest Version. Default: false.
    #force32bit: false # boolean. Use 32 bit version on x64 agents. Default: false.
# Use Node.js ecosystem v1
# Set up a Node.js environment and add it to the PATH, additionally providing proxy support.
- task: UseNode@1
  inputs:
    #version: '10.x' # string. Version. Default: 10.x.
    #checkLatest: false # boolean. Check for Latest Version. Default: false.

输入

version - 版本
string。 默认值:10.x

必填。 使用 SemVer 的版本范围语法指定 Node.js 版本。 示例:10.x10.15.1>=10.15.0


checkLatest - 检查最新版本
boolean。 默认值:false

联机检查满足版本规范的最新可用版本。除非需要始终具有最新版本,否则应 false。 将值设置为 true 将导致任务产生可能不必要的下载成本,尤其是在托管生成池中。


force32bit - 在 x64 代理上使用 32 位版本
boolean。 默认值:false

在 64 位 Windows 代理上安装 x86 版本的 Node.js。 仅适用于 Windows 代理。


retryCountOnDownloadFails - 当节点下载失败时设置重试计数
string。 默认值:5

当任务无法从镜像下载节点二进制文件时使用此选项。 该任务将重试下载指定时间的二进制文件。


delayBetweenRetries - 设置重试之间的延迟
string。 默认值:1000

使用此选项可设置重试之间的延迟(以毫秒为单位)。 默认值为 1000 毫秒。


任务控制选项

除任务输入之外,所有任务都具有控制选项。 有关详细信息,请参阅 控件选项和常见任务属性

输出变量

没有。

要求

要求 说明
管道类型 YAML,经典版本,经典版本
运行时间 代理,DeploymentGroup
需求 没有
功能 运行此任务满足以下 要求 同一作业中的任何后续任务:Node、npm、node.js
命令限制 任何
Settable 变量 任何
代理版本 2.144.0 或更高版本
任务类别 工具