共用方式為


UseNode@1 - 使用 Node.js 生態系統 v1 工作

使用此工作來尋找、下載和快取指定的 Node.js 版本,並將它新增至PATH。 此工作也提供 Proxy 支援。

語法

# 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、傳統組建、傳統版本
執行於 Agent、DeploymentGroup
需求 沒有
功能 執行此工作符合下列 要求, 相同作業中的任何後續工作:Node、npm、node.js
命令限制 任意
Settable 變數 任意
代理程式版本 2.144.0 或更新
工作類別 工具