gradle-node-plugin icon indicating copy to clipboard operation
gradle-node-plugin copied to clipboard

npmInstall task delay (16 minutes)

Open RamonaBarbieru opened this issue 4 months ago • 2 comments

We have been using gradle-node-plugin for a few years now and it has worked normally (thank you). Now, due to an angular version update (from angular 19 to 20) we have been forced to update the nodeJs version (from 20.18 to 22.12.0 with respective npm update) and with this change the npmInstall and npm_install tasks both take 16 minutes each. There is no variation to that time and I have tried different options like packages versions changes, gradle update (from our current 8.8 to 8.14.3), gradle-node-plugin update from 7.0.1 to 7.1.0. I tried the option npmInstallCommand with both install and ci. There is absoutely no variation. It works fine afterwards but adding 30 minutes to the build time is not something that we can accommodate. One note I have to make is that on my local machine where I already have the new node and npm versions available, the build time is small even with the latest updates. The problem occurs when I deploy with Jenkins on the infrastructure it works on. Is there some interaction that can occur with other version of nodeJs? If you can lead me in any direction.. it would be very helpful.

05:31:31 > Task :client:npmInstall 05:31:31 05:31:31 added 620 packages, and audited 830 packages in 16m 05:31:31 05:31:31 137 packages are looking for funding 05:31:31 run npm fund for details 05:31:31 05:31:31 found 0 vulnerabilities 05:32:06 05:32:06 > Task :client:npm_install 05:47:25 05:47:25 added 15 packages, and audited 845 packages in 16m 05:47:25 05:47:25 138 packages are looking for funding 05:47:25 run npm fund for details 05:47:25 05:47:25 found 0 vulnerabilities

RamonaBarbieru avatar Jul 16 '25 12:07 RamonaBarbieru

This definitely sounds weird, and not something I'd expect to happen from a nodejs upgrade But first things first, why do you have both npmInstall and npm_install? Generally you only want npmInstall since that's where all the logic is

So with npm reporting the install taking 16 minutes the above should cut the time in half, but there's not much the plugin can do to speed up that install If I were to guess I'd expect that with the move to angular 20 you probably ended up getting even more dependencies than before, so first I'd check that all your lockfiles are up to date and committed And after that I'd check whether there's any dependencies you no longer use and can remove

deepy avatar Jul 18 '25 14:07 deepy

There's a bunch of things that could affect the time, but if you use a npm mirror that's close to your CI you should be able to speed up fetching dependencies as well

deepy avatar Jul 18 '25 14:07 deepy