srs / gradle-node-plugin

Gradle plugin for integrating NodeJS in your build. :rocket:
Apache License 2.0
867 stars 210 forks source link

Plugin reinstalls node every run? #333

Open virgo47 opened 5 years ago

virgo47 commented 5 years ago

Hi We used configuration like this:

node {
    version = versionNodejs
    npmVersion = versionNpm

    distBaseUrl = 'https://nodejs.org/dist'
    download = true
    workDir = file("${toolsDir}/nodejs")
    npmWorkDir = file("${toolsDir}/npm")
}

Today we noticed that the build complained it can't remove node.exe when we tried it on our local Windows machine. We were surprised. Why does it want to remove exisitng EXE file? We checked our CI server and, indeed, node installation has fresh timestamps from the last build. Why does this happen? Can't it just check it's there already? Is it intentional, or are we doing something wrong?

imanushin commented 5 years ago

@virgo47, do you have multimodule project?

I explained existing bug here: https://github.com/srs/gradle-node-plugin/issues/256#issuecomment-477932029

virgo47 commented 5 years ago

I do have a multimodule project, but only one Gradle project (module) uses the plugin. However we decided to manage our environment with shell script, so now we manage Node+NPM (alongside Java home as well) outside of Gradle, set it to path and use the plugin without node configuration, as it finds expected Node+NPM.

So we walked around the problem with the benefit of having script for setting up our environment for subsequently running npm from the command line which is handy for normal development + faster than running the same command with Gradle.