srs / gradle-node-plugin

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

Could not ind ivy.xml #292

Open jchapelle opened 6 years ago

jchapelle commented 6 years ago

When trying to install node, yarn and npm with this configuration

node {
    download = true
    version = '8.9.1'
    distBaseUrl = 'https://nodejs.org/dist'
    npmVersion = '5.5.1'
    yarnVersion = '1.5.1'
    nodeModulesDir = file("${project.projectDir}")
}

The following error is received Could not get resource 'https://nodejs.org/dist/v8.9.1/ivy.xml'.

Indeed, no ivy.xml file exist on nodejs.org website. What's wrong here ? How to fix ?

f3rdy commented 6 years ago

Could you please give more info on

VBourdine commented 6 years ago

I have the same issue. There you go my build.gradle:

plugins {
    id "com.moowork.node" version "1.2.0"
}

node {
    distBaseUrl = 'https://nodejs.org/dist'
    version = '8.11.2'
    download = true
}

I am trying to run just nodeSetup behind the proxy. The Output looks like:

14:47:41: Executing task 'nodeSetup'...

> Task :nodeSetup
> Task :nodeSetup FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':nodeSetup'.
> Could not resolve all files for configuration ':detachedConfiguration1'.
   > Could not resolve org.nodejs:node:8.11.2.
     Required by:
         project :
      > Could not resolve org.nodejs:node:8.11.2.
         > Could not get resource 'https://nodejs.org/dist/v8.11.2/ivy.xml'.
            > Could not GET 'https://nodejs.org/dist/v8.11.2/ivy.xml'.
               > Connect to nodejs.org:443 [nodejs.org/104.20.23.46, nodejs.org/104.20.22.46] failed: Connection timed out: connect

* 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

BUILD FAILED in 50s
1 actionable task: 1 executed
Connection timed out: connect
14:48:32: Task execution finished 'nodeSetup'.
inero commented 6 years ago

I'm also facing the same kind of issue, any solution/update on this would be great?

liamsteele commented 5 years ago

This is definitely a proxy issue. It's silently failing to get the dist zip and falling back to trying to get ivy.xml which doesn't exist.

For me, all my proxy settings were correct, but px was timing out for some mysterious reason. Swapping back to using cntlm worked. Using the proxy directly would also likely work.

aollag09 commented 5 years ago

Hi there,

Same problem on my side :( Any idea how to solve this issue ? This ivy.xml seems to no longer exist in nodejs.org/dist ...

Thanks for your help :) !

14:37:07.077 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong: 14:37:07.077 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Execution failed for task ':nodeSetup'. 14:37:07.077 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not resolve all files for configuration ':detachedConfiguration1'. 14:37:07.077 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not resolve org.nodejs:node:8.11.2. 14:37:07.077 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Required by: 14:37:07.077 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] project : 14:37:07.077 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not resolve org.nodejs:node:8.11.2. 14:37:07.077 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not get resource 'https://nodejs.org/dist/v8.11.2/ivy.xml'. 14:37:07.077 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Could not GET 'https://nodejs.org/dist/v8.11.2/ivy.xml'. 14:37:07.077 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderExcepti on: unable to find valid certification path to requested target

dhakehurst commented 5 years ago

any progress on this ?

liamsteele commented 5 years ago

There's not much to do here, it's a proxy issue on your end.

The only progress that could be made on this issue is adding better logging/error messages when it occurs.

judos commented 4 years ago

Had the same issue on one project, other project worked. Only difference was gradle wrapper version. I now reverted the newer project from gradle 6.0 to gradle 4.10.3 and that works fine ;) To change gradle wrapper version in your project you can use this cmd: gradle wrapper --gradle-version=4.10.3

So I think this is related to the ticket: https://github.com/srs/gradle-node-plugin/issues/351

Also note: ivy.xml was a fallback and does not actually exist (saw that when checking the older project where it works for me.) And secondly "proxy issue" doesn't make sense. Otherwise it would work for all or no projects on the same machine, which is not the case for me.

Hope that gives some insight to many devs suffering from this issue.

daggerok commented 4 years ago

are there some plans to fix it?

tdennler commented 4 years ago

I have seen this issue as well. The problem is related to some optimization in the gradle repository resolution logic. In gradle 6 the default behavior is to look only for metadata files and not the actual artifact (which is a second HTTP Get). The old behavior can be restored with some additional configuration to the repository definition.

The issue with the node plugin is that for fetching the node artifacts the repository definition is somewhat hard coded in com.moowork.gradle.node.task.SetupTask.addRepository method, which will remove all configured repos for the project, set in a specific repo to use for node resolution, and will restore the project repos later when node is resolved. To restore the old gradle resolution behavior requires a change like the following to this code to have gradle search for both the ivy metadata or the artifact (note the metadataSources enclosure).

    this.repo = this.project.repositories.ivy {
        url distUrl
        layout 'pattern', {
            artifact 'v[revision]/[artifact](-v[revision]-[classifier]).[ext]'
            ivy 'v[revision]/ivy.xml'
        }
        metadataSources {
            ivyDescriptor()
            artifact()
        }
    }

When I added this hack to a copy of the node plugin code and rebuilt it, I was able to get past this issue.

Another solution would be to get the ivy metadata file added for the node artifact in the repo hard coded in the gradle plugin: https://nodejs.org/dist (or point to a repo that has the missing ivy descriptor for this artifact).

deepy commented 4 years ago

The reason we forked this is because of Gradle 5+ compat, if you can live without grunt/gulp (or can use NpxTask to run them) there's https://github.com/node-gradle/gradle-node-plugin

daggerok commented 4 years ago

Hello,

Thank you @deepy for solution! I can confirm that this:

plugins {
    // id("com.moowork.node") version "1.3.1"
    id("com.github.node-gradle.node") version "2.2.0"
}

node {
    download = true
    version = "12.13.1"
    npmVersion = "6.9.0"
    yarnVersion = "1.17.3"
    nodeModulesDir = project.file("ui")
    workDir = project.file("${project.buildDir}/nodejs")
    npmWorkDir = project.file("${project.buildDir}/npm")
    yarnWorkDir = project.file("${project.buildDir}/yarn")
}

and these tasks are working as expected on Gradle 6.0.1:

./gradlew nodeSteup
./gradlew npmSteup
./gradlew npm_i
./gradlew npm_run_build

Regards, Maksim

MrException commented 4 years ago

Thank you @deepy for solution!

petrabrunner commented 4 years ago

can confirm that @deepy's solution also worked for me. thx! Thx @daggerok for testing and posting!

Yachin commented 4 years ago

The reason we forked this is because of Gradle 5+ compat, if you can live without grunt/gulp (or can use NpxTask to run them) there's https://github.com/node-gradle/gradle-node-plugin

Hi, what should I do if our project use gulp? apply plugin:'com.moowork.gup' node{ download = true version='11.15.0' }

It cannot find ivy.xml and node-v11.15.0-linux-x86.tar.gz I am running on Windows 10 with JDK 8 (64 bit) and JAVA runtime (64 bit)

Thank you.

deepy commented 4 years ago

How reliant on gulp are you? Could you use gulp through npx as a workaround?

Yachin commented 4 years ago

How reliant on gulp are you? Could you use gulp through npx as a workaround?

@deepy The project used to run fine for my Windows machine. Till we added

do you know where I can find implementation documents about npx? Thank you!

ovflowd commented 1 year ago

Hey there 👋 Node.js team here.

This behaviour was introduced with https://github.com/nodejs/build/issues/3223 so that y'all can track why this is happening now. Note that is expected behaviour. And that this https://github.com/srs/gradle-node-plugin/issues/292#issuecomment-562848790 comment above is a proper fix for the issue.

Extra details are also available here https://github.com/nodejs/nodejs.org/issues/5149#issuecomment-1476537829

shilan commented 1 year ago

Adding the ,plugin I still get the same error. Could it be because I am using node version 10 and that is not supported anymore?

deepy commented 1 year ago

You need Gradle 4.5 or newer, if you cannot upgrade from Gradle 4 I recommend you upgrade to the latest Gradle 4.10.3

Houinside commented 1 year ago

Hi guys, change distBaseUrl like this:

node {
  ...
  distBaseUrl = 'https://direct.nodejs.org/dist/'
  ...
}

ref from https://github.com/nodejs/nodejs.org/issues/5149#issuecomment-1470896878