# Task installNode
- Install Node.js ↑
- Inputs:
- S
nodeVersion
:nodeVersion
property - S
nodeDistributionUrlRoot
:nodeDistributionUrlRoot
property - S
nodeDistributionUrlPathPattern
:nodeDistributionUrlPathPattern
property - F
nodeInstallDirectory
:nodeInstallDirectory
property
- S
- Outputs:
- RF
nodeExecutableFile
:nodeInstallDirectory
/node.exe
ornodeInstallDirectory
/bin/node
depending on the O/S.
- RF
- Skipped when property
nodeDistributionProvided
istrue
.
The task downloads a Node.js distribution, verifies its integrity, and installs it in the directory pointed by the nodeInstallDirectory
property. The URL used to download the distribution is resolved using the nodeDistributionUrlRoot
property and the nodeDistributionUrlPathPattern
property. Checking the distribution integrity consists of downloading a file providing the distribution shasum. This file is expected to be in the same remote web directory than the distribution archive. For example, if the distribution is located at https://nodejs.org/dist/vX.Y.Z/node-vX.Y.Z-win-x64.zip
, the plugin attempts to download the shasum file located at https://nodejs.org/dist/vX.Y.Z/SHASUMS256.txt
. By default, the plugin relies on the VM network properties to know if a proxy server shall be used when downloading the distribution and the shasum. A custom proxy server may also be used by defining httpsProxyHost
property (respectively httpProxyHost
property) if the nodeDistributionUrlRoot
property uses the https
protocol (resp. uses the http
protocol). In case of connectivity/HTTP error, download of the distribution file and the shasum file may be retried using property maxDownloadAttempts
.
If a Node.js distribution is already installed in the system, either as a global installation or as an installation performed by another Gradle (sub-)project, and shall be used instead of a downloaded distribution, take a look at the nodeDistributionProvided
property instead: when true
, this task is ignored if invoked during a Gradle build, and its outcome will always be SKIPPED.
The task takes advantage of Gradle incremental build, and is not executed again unless one of its inputs/outputs changed. In this case, the task outcome will be UP-TO-DATE.
This task should not be executed directly. Gradle executes it if the build requires it.