srs / gradle-node-plugin

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

Upgrading node to version 12.15.0 build failure #365

Open induja0107 opened 4 years ago

induja0107 commented 4 years ago

I tried changing node version to 12.15.0 and the build fails. 12.13.1 version of node works fine. Does the gradle-node-plugin need to be updated to support latest node version? Or is there a way i can use the 12.15.0 using the 1.1.0 of the gradle-node-plugin?

deepy commented 4 years ago

How did the build fail? I can't think of anything that should break

Kobe commented 4 years ago

it fails with latest Gradle 6.x release for every node.js version since 12.x

* What went wrong:
Execution failed for task ':nodeSetup'.
> Could not resolve all files for configuration ':detachedConfiguration1'.
   > Could not find org.nodejs:node:12.15.0.
     Searched in the following locations:
       - https://nodejs.org/dist/v12.15.0/ivy.xml
     Required by:
         project :

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.1.1/userguide/command_line_interface.html#sec:command_line_warnings

but it works with latest 5.x release

allnightlong commented 4 years ago

Same problem here

Kobe commented 4 years ago

I found a solution / workaround last night. It's using node-gradle plugin to download node/yarn/npm but on top of that gradle-node-plugin tasks.

import com.moowork.gradle.node.yarn.YarnTask

plugins {
    id("com.github.node-gradle.node") version "2.2.1"
}

repositories {
    jcenter()
}

node {
    // PLEASE use node LTS version or version with even major number
    version = "12.15.0"
    yarnVersion = "1.22.0"
    download = true
}

tasks {
    val build by registering(YarnTask::class) {
        dependsOn("yarn_install")
        args = listOf("build")
    }
}
deepy commented 4 years ago

The problem is (or at least should be) Gradle 6.x, not the node version, you can see #315 for more information about the issue. There's multiple issues/PRs about the lack of Gradle 6 support.

The plugin you're using in the solution is the fork available at https://github.com/node-gradle/gradle-node-plugin which should work fine with all available Gradle versions ;-)

Kobe commented 4 years ago

@deepy I didn't find any fork hints or something like that so I assumed it's a different plugin.

Do I need import com.moowork.gradle.node.yarn.YarnTask or is there another solution?

deepy commented 4 years ago

The fork should work fine without any workarounds, I don't think you need to import YarnTask to get this to work, simply changing to id("com.github.node-gradle.node") version "2.2.1" should be fine

Kobe commented 4 years ago

I don‘t think so due to you need to import YarnTasks.

Jensen-Mourat commented 2 years ago

Added a fork with the fix for those using earlier gradle versions (Tested with gradle 2.11).

https://github.com/Jensen-Mourat/gradle-node-plugin