Skip to content

7.0.1: Gradle 8.10 npmInstall Task Delays Execution (10-20 Minutes) of npm ci Before Successful Task Completion #332

@NiC0x36

Description

@NiC0x36

Description:

When using the npmInstall task with with npmInstallCommand='ci' defined, the task appears to hang for approximately 10 or 20 minutes (depending on the project) before the task is successfully executed. This issue doesn't seem to be a timeout itself or proxy issue, but rather a delay caused by the Gradle task before actually executing npm ci in npmInstall.

The issue only emerges when using Gradle 8.10 but not with 7.3.3. Tested with the same Angular project on different branches (Gradle Version differentiates). It's also persistent over different npm projects and machines.

When using my own install task with an npm ci command, it executes without hesitation. (see: npm_ci_install under Steps to Reproduce)

Issue Summary:

Problem: The task appears to finish (all packages installed, no errors), but Gradle does not proceed with the next task for an additional 10 minutes. This delay can be reproduced with an own built npmInstall (ci) task, where outputs.dir 'node_modules' is defined:

Root Cause (Hypothesis): The delay may be due to Gradle waiting for the npmInstall task to complete its process, even though the install itself is done. It seems to wait for an internal timeout (around 10 minutes) before it proceeds with the next task. I did not find out what exactly it is caused by.

Steps to Reproduce:

Configure the node plugin as follow:

node {
    version = '20.17.0'
    npmVersion = '10.8.2'
    download = true
    npmInstallCommand = 'ci'
    npmInstall.args = ['--loglevel', 'error']
}

Create a custom npm ci task with outputs.dir 'node_modules':

tasks.register("npm_ci_install", NpmTask) {
    dependsOn "nodeSetup", "npmSetup"

    inputs.file 'package.json'
    inputs.file 'package-lock.json'
    outputs.dir 'node_modules' // causes the long wait time

    workingDir = projectDir
    args = ['ci']
}

Expected Behavior:

The custom npm ci task should complete and immediately proceed with the next task without any delay.

Actual Behavior:

The task appears to finish and shows no errors, but it stays in the npmInstall state, waiting for an internal timeout of about 10 minutes.

Environment:

  • 'com.github.node-gradle.node' version '7.0.1'
  • Gradle version: 8.10
  • Node version: 20.17.0
  • npm version: 10.8.2
  • Windows 11, version 24H2

Additional Information:

As a workaround I implemented my own npm install ci Task, which helps preventig the delay issue, but the root cause remains the same. I use a marker file instead of a outputs.dir 'node_modules'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions