10

I am getting this Gradle error today (it worked fine before). Thank you in advance for your help.

Execution failed for task ':nodeSetup'.

Could not resolve all dependencies for configuration 'detachedConfiguration16'. Could not resolve org.nodejs:node:14.19.3. Required by: project : > Could not resolve org.nodejs:node:14.19.3. > Could not get resource 'https://nodejs.org/dist/v14.19.3/ivy.xml'. > Could not GET 'https://nodejs.org/dist/v14.19.3/ivy.xml'. Received status code 403 from server: Forbidden

Gradle version: 3.1

build.gradle configuration:

dependencies {
    classpath "com.github.node-gradle:gradle-node-plugin:2.2.4"
}

apply plugin: "com.github.node-gradle.node"

node {
    version = '14.19.3'
    download = true
}

We were using moowork as the build plugin and got the same error.

We also tried the latest gradle-node-plugin (3.5.1), and we got kotlin error (java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics).

Jack Cui
  • 101
  • 3
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Mar 21 '23 at 05:02
  • 1
    We see the same issue with our builds. The gradle plugin tries to access the ivy.xml file and receives a 403 Forbidden. My assumption is that before this yielded a 404 and gradle then tried to download the artifact directly like: https://nodejs.org/dist/v14.18.2/node-v14.18.2-darwin-x64.tar.gz – Larusso Mar 21 '23 at 10:14
  • Mine also stopped working with the same error just two weeks ago. I was thinking might have something to do with an unsupported version node10 we are using? – Shilan Apr 20 '23 at 11:27

2 Answers2

9

Try this configuration in your build.gradle:

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

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

wmax
  • 1,014
  • 10
  • 21
2

Please remove --refresh-dependencies from gradle parameters. I had the same issue this morning and it worked for me. I assume they installed some sort of DDNS prevention software that is blocking multiple requests from the same IP.

sutudu
  • 21
  • 3
  • where are those --refresh-dependencies? – Shilan Apr 20 '23 at 11:32
  • 1
    I had this parameter in the invocation to gradle and I guess this was probably causing too many requests to the website, which ended up blocking me every time. If you don't use this parameter then I'm afraid my solution won't help you – sutudu Apr 21 '23 at 18:28
  • No, I am not but adding distBaseUrl like @wmax suggested, solves my issue. – Shilan Apr 22 '23 at 03:04