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

Can't download any node distribution from nodejs.org (plugin v.0.13)

Open czterystaczwarty opened this issue 9 years ago • 7 comments

During build can not resolve any node.js distribution from https://nodejs.org/dist.

Execution failed for task ':war-admin:nodeSetup'.
> Could not resolve all dependencies for configuration 'detachedConfiguration1'.
   > Could not resolve org.nodejs:node:4.4.7.
     Required by:
         org.company.project:war-admin:1.63.0-rc1.1
      > Could not resolve org.nodejs:node:4.4.7.
         > Could not get resource 'https://nodejs.org/dist/v4.4.7/ivy.xml'.
            > Could not GET 'https://nodejs.org/dist/v4.4.7/ivy.xml'.
               > RSA premaster secret error

NOTE: It worked couple months and failed on new machine without node cached in gradle . Reproduced by change node version.

plugin version: 0.13, gradle version: 2.14

buildscript {
    repositories {
        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }

    dependencies {
        classpath "com.moowork.gradle:gradle-node-plugin:0.13"
    }
}
/.../
apply plugin: 'com.moowork.node'

node {
    // Node.js LTS
    version = '4.4.7'
    distBaseUrl = 'https://nodejs.org/dist'
    download = true
}

czterystaczwarty avatar Jul 05 '16 08:07 czterystaczwarty

Hi.

Replicated your setup on a new machine (docker instance) and it does not fail. Are you sure https://nodejs.org/dist is reachable from your computer or if you have any "firewalls" blocking the request?

srs avatar Jul 05 '16 10:07 srs

I see that you get an RSA premaster secret error. Seems that somethings wrong with the certificates on your machine.

Just did a quick google search on it and this came up: https://developer.ibm.com/answers/questions/206325/how-to-fix-this-ssl-error-javaxnetsslsslkeyexcepti.html

srs avatar Jul 05 '16 10:07 srs

When plugin try to resolve dist/v4.4.7/ivy.xml over http, server redirect to https 404 html page. Then IBM JVM 1.6 cannot handle credentials and download fail.

We tried to add a certificate nodejs.org a jvm. Without results. For now we decided to use a global node on every machine by download = false.

czterystaczwarty avatar Jul 11 '16 12:07 czterystaczwarty

Same problem here.

Could not find org.nodejs:node:10.15.0.
Searched in the following locations:
  - https://nodejs.org/dist/v10.15.0/node.module
  - https://nodejs.org/dist/v10.15.0/ivy.xml

If you open https://nodejs.org/dist/v10.15.0/ you can actually see that there is no node.module or ivy.xml. I have no idea what is going on

SETUP (in Kotlin):

  • Gradle 4.10.0 and 5.0
  • OpenJDK 10.0.1 and OracleJDK 8.181
plugins {
    id("com.moowork.node") version "1.2.0"
}

node {
    download = true
    version = "10.15.0"
}

fun org.gradle.api.Project.node(block: NodeExtension.()->Unit) 
        = configure(block)

It is working on another project on same machine, at least until last Christmas.

lamba92 avatar Jan 20 '19 19:01 lamba92

It seems like the distbaseUrl is not setup correctly because it adds org.nodejs/ to the path.

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

Results in Error:

> Could not resolve all dependencies for configuration 'detachedConfiguration1'.
   > Could not find org.nodejs:node:10.15.0.
     Searched in the following locations:
         https://nodejs.org/dist/org.nodejs/node/10.15.0/ivys/ivy-10.15.0.xml
         https://nodejs.org/dist/org.nodejs/node/10.15.0/tar.gzs/node-tar.gz-linux-x64-10.15.0.tar.gz
         https://nodejs.org/dist/org.nodejs/node/10.15.0/tar.gzs/ivy-10.15.0.xml

davthu avatar Feb 07 '19 09:02 davthu

I have started getting this issue, works fine on one ( older) project, new project just created will not download!!

any progress on tracking the issue?

dhakehurst avatar Jul 10 '19 14:07 dhakehurst

There seems to be no problem on a single project, but for me a sub project in a multi-project build always fails to download,

For anyone else landing here, I solved this by simple not using the mooworks node plugin anymore.

My build uses the kotlin plugin anyhow, which as for version 1.3.41 is able to download a nodejs/yarn/etc.

I just use that instead, e.g. parent project must apply the kotlin plugin (js or multiplatform)

in the sub project,

import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsPlugin
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnSimple

...

tasks.create<DefaultTask>("yarn_install") {
    doLast {
        // ensure that node is downloaded by kotlin plugin (by default into ~/.gradle/nodejs)
        val nodeJs = NodeJsPlugin.apply(project.rootProject)
        YarnSimple.yarnExec(project, file("${ngDir}"), "yarn_install", "install", "--cwd", "--no-bin-links")
    }
}

dhakehurst avatar Jul 12 '19 11:07 dhakehurst