gradle-node-plugin
gradle-node-plugin copied to clipboard
Enable Verbose Logging
I can't figure out how to turn on verbose logging for any of the tasks. Here's what I tried:
npmInstall.args = [
'--loglevel', 'verbose'
]
Also tried ./gradlew clean build --debug but no luck
I want to turn on verbose logging because npmInstall is taking forever and I have no idea what it's doing :(
Any ideas? Thanks in advance.
When it launches some Node.js, npm or yarn command, this plugin does not put them in verbose mode if Gradle is asked to run in verbose mode. This is maybe something we should do in the future.
For now, some things that could help:
- Run Gradle with the
--infoparameter, it will explain why each task runs. The best way to run fast is to not run at all. ThenpmInstalltask is correctly configured by the plugin by default and should run only when thepackage.jsonfile changes. Sometimes it is necessary to configure it becausenpmInstallmodifies thenode_moduledirectory when it runs. Does yournpmInstalltask run when nothing changed? - I noticed that the process of checking whether the
npmInstall' task's output changed (i.e. thenode_modulesdirectory) can take so long, specifically on Windows when thenode_modulesdirectory is big. Is yournode_modulesdirectory big? Are you using Windows? If you think that it can come from that, tell me and I will send you some hints to ensure about that. You can try to enable the Gradle Filesystem Watching that should speed up this scenario by continuously watching thenode_modulesdirectory instead of browsing it entirely just before running the task. - The configuration you tried for
npmInstallseems to be good. It did not change anything? Did thenpmInstalltaks run?
@bsautel Thanks so much for getting back to me. --info parameter has been extremely useful for visibility into what the tasks are doing.
-
It looks like the change detection of inputs (
src/,node_modules, etc) takes up well over one minute.npmInstalllooks like it doesn't run after making sure there's no changes. Not sure what I can do about the one-minute delay. -
Yes,
node_modulesis "huge"--I'm running red hat 7. Unfortunately I'm locked into Gradle 5.1 at the moment. Could you send hints to speed up the check?
Ok, so as far as I understand Gradle spends at least one minute on the npmInstall but it finally does not run it (with UP-TO-DATE status). Since the task did not run, you should have no npm install log.
I don't have any magic solution to speed up the check.
Are you filtering the node_modules directory as explained here? This is know to slow down the up-to-date checking.
Also, which version of the plugin are you using?
And in the case you don't know about that, the Gradle wrapper enables you to use any Gradle version without having it installed on your computer (it automatically downloads and use it). I don't know why you are locked on Gradle 5.1 but if it is for a technical reason, this may help you.
Thanks for that. I added the node_modules filter in this morning. I noticed I don't have a package/package.json file inside node_modules. Should I?
Currently using 2.2.4. I was a little hesitant to use 3.0.0 because it is a dot-zero major release (slightly riskier than a mature release that's been patched multiple times).
Unfortunately gradle 5.1 is the latest version I have available to me in my current situation.
Add the node_modules filter only if you need it, if you don't need remove it because it seems to slow down up-to-date checking.
And you don't need to have a package.json or a package-lock.json in the node_modules directory, generally they are in the folder containing the node_modules directory.
The 3.0.0 version is a complete rewrite of the plugin in Kotlin. Its behavior is very close to the 2.2.4, even if we added some new features. It has a quite good code coverage, so migrating to it is not so risky. But it does not officially support Gradle 5.1, the oldest supported Gradle version is 5.6. For older versions, it may work but we do not have any test to ensure that.