node-gradle / node-gradle/gradle-node-plugin
7.0.1: Gradle 8.10 npmInstall Task Delays Execution (10-20 Minutes) of npm ci Before Successful Task Completion
Nobody has claimed this yet.
- Dominant language
- Groovy
- Stars
- 677
- Forks
- 120
- PR merge metrics
- No merged PRs in 30d
Description
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'.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the npmInstall task and the custom NpmTask reproduction, especially the outputs.dir 'node_modules' declaration, and compare behavior under Gradle 7.3.3 and 8.10. Reproduce on the stated Node, npm, plugin, and Windows versions, then trace why task completion is delayed; done means npm ci proceeds immediately to the next task without the 10–20 minute wait.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy, nodejs
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100