共用方式為


NodeTool@0 - Node.js 工具安裝程式 v0 工作

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

有較新版本的工作可供使用。 如需詳細資訊,請參閱 UseNode@1

語法

# Use Node.js ecosystem v0
# Finds or downloads and caches the specified version spec of Node.js and adds it to the PATH.
- task: NodeTool@0
  inputs:
    versionSource: 'spec' # 'spec' | 'fromFile'. Required. Source of version. Default: spec.
    #versionSpec: '6.x' # string. Optional. Use when versionSource = spec. Version Spec. Default: 6.x.
    #versionFilePath: # string. Optional. Use when versionSource = fromFile. Path to the .nvmrc file. 
    #checkLatest: false # boolean. Check for Latest Version. Default: false.
    #force32bit: false # boolean. Use 32 bit version on x64 agents. Default: false.
  # Advanced
    #nodejsMirror: 'https://nodejs.org/dist' # string. Set source for Node.js binaries. Default: https://nodejs.org/dist.
    #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 v0
# Finds or downloads and caches the specified version spec of Node.js and adds it to the PATH.
- task: NodeTool@0
  inputs:
    versionSource: 'spec' # 'spec' | 'fromFile'. Required. Source of version. Default: spec.
    #versionSpec: '6.x' # string. Optional. Use when versionSource = spec. Version Spec. Default: 6.x.
    #versionFilePath: # string. Optional. Use when versionSource = fromFile. Path to the .nvmrc file. 
    #checkLatest: false # boolean. Check for Latest Version. Default: false.
    #force32bit: false # boolean. Use 32 bit version on x64 agents. Default: false.
  # Advanced
    #nodejsMirror: 'https://nodejs.org/dist' # string. Set source for Node.js binaries. Default: https://nodejs.org/dist.
# Use Node.js ecosystem v0
# Finds or downloads and caches the specified version spec of Node.js and adds it to the PATH.
- task: NodeTool@0
  inputs:
    versionSpec: '6.x' # string. Required. Version Spec. Default: 6.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 v0
# Finds or downloads and caches the specified version spec of Node.js and adds it to the PATH.
- task: NodeTool@0
  inputs:
    versionSpec: '6.x' # string. Required. Version Spec. Default: 6.x.
    #checkLatest: false # boolean. Check for Latest Version. Default: false.

輸入

versionSource - 版本 的來源
string。 必須的。 允許的值:spec(指定節點版本)、fromFile(從檔案取得版本)。 預設值:spec


versionSpec - 版本規格
string。 選擇性。 versionSource = spec時使用 。 預設值:6.x

指定要取得的版本規格。 範例:6.x4.x6.10.0>=6.10.0


versionSpec - 版本規格
string。 必須的。 預設值:6.x

指定要取得的版本規格。 範例:6.x4.x6.10.0>=6.10.0


versionFilePath - .nvmrc 檔案的路徑
string。 選擇性。 versionSource = fromFile時使用 。

要取得版本的檔案路徑。 範例:src/.nvmrc。


checkLatest - 檢查最新版本
boolean。 預設值:false

指定要檢查符合版本規格之最新可用版本的代理程式。例如,您可以選取此選項,因為您會在 自我裝載代理程式上執行此組建,而且您想要一律使用最新的 6.x 版本。

小提示

如果您使用 Microsoft 載入的代理程式,您應該將此設定保留為 false。 Microsoft定期更新Microsoft裝載的代理程式,但它們通常略落後於最新版本。 啟用此參數可能會導致您的組建花費大量時間更新為較新的次要版本。


force32bit - 在 x64 代理程式上使用 32 位版本
boolean。 預設值:false

不論代理程式的 CPU 架構為何,都會安裝 x86 版的 Node。


nodejsMirror - 設定 Node.js 二進位檔的來源
string。 預設值:https://nodejs.org/dist

在來源 Node.js 二進位檔時,請使用替代安裝鏡像。


retryCountOnDownloadFails - 節點下載失敗時設定重試計數
string。 預設值:5

當工作無法從鏡像下載節點二進位檔時,請使用此選項。 工作會重試下載指定時間的二進位檔。


delayBetweenRetries - 設定重試之間的延遲
string。 預設值:1000

使用此選項可設定毫秒內重試之間的延遲。 預設值為1000毫秒。


工作控制選項

除了工作輸入之外,所有工作都有控制選項。 如需詳細資訊,請參閱 控制項選項和一般工作屬性

輸出變數

沒有。

備註

有較新版本的工作可供使用。 如需詳細資訊,請參閱 UseNode@1

需求

要求 說明
管線類型 YAML、傳統組建、傳統版本
執行於 Agent、DeploymentGroup
需求 沒有
功能 執行此工作符合下列 要求, 相同作業中的任何後續工作:Node、npm、node.js
命令限制 此工作會使用下列 命令限制執行: 受限制
Settable 變數 此工作具有 設定下列變數的許可權: PATH
代理程式版本 2.182.1 或更新
工作類別 工具
要求 說明
管線類型 YAML、傳統組建、傳統版本
執行於 Agent、DeploymentGroup
需求 沒有
功能 執行此工作符合下列 要求, 相同作業中的任何後續工作:Node、npm、node.js
命令限制 任意
Settable 變數 任意
代理程式版本 所有支援的代理程式版本。
工作類別 工具

另請參閱

如需工具安裝程式和範例的說明,請參閱 工具安裝程式