srs / gradle-node-plugin

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

Plugin attempts to download a nonexistent linux-x86 dist #350

Open Hypnosphi opened 4 years ago

Hypnosphi commented 4 years ago

I try to run my gradle task on a linux agent on CI. Here's the relevant part of build.gradle:

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

node {
  download = true
}

It fails on :nodeSetup task:

[Step 4/4] Execution failed for task ':nodeSetup'. org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':detachedConfiguration1'.
[00:35:17][Step 4/4] Process exited with code 1
[00:35:17][Step 4/4] Gradle failure report
[00:35:17][Gradle failure report] FAILURE: Build failed with an exception.
[00:35:17][Gradle failure report] 
[00:35:17][Gradle failure report] * What went wrong:
[00:35:17][Gradle failure report] Execution failed for task ':nodeSetup'.
[00:35:17][Gradle failure report] > Could not resolve all files for configuration ':detachedConfiguration1'.
[00:35:17][Gradle failure report]    > Could not find org.nodejs:node:10.15.3.
[00:35:17][Gradle failure report]      Searched in the following locations:
[00:35:17][Gradle failure report]        - https://nodejs.org/dist/v10.15.3/ivy.xml
[00:35:17][Gradle failure report]        - https://nodejs.org/dist/v10.15.3/node-v10.15.3-linux-x86.tar.gz
[00:35:17][Gradle failure report]      Required by:
[00:35:17][Gradle failure report]          project :
[00:35:17][Gradle failure report] 
[00:35:17][Gradle failure report] * Try:
[00:35:17][Gradle failure report] 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.
[00:35:17][Gradle failure report] 
[00:35:17][Gradle failure report] * Get more help at https://help.gradle.org
[00:35:17][Gradle failure report] 
[00:35:17][Gradle failure report] BUILD FAILED in 8s

There's no linux-x86 distribution in https://nodejs.org/dist/v10.15.3/

deepy commented 4 years ago

That's correct, there's no 32bit version of node v10.15.3, if you want to run it on a 32bit system you'll have to pick an earlier version of node.

paksv commented 4 years ago

@deepy actually, the question is why does it try to download an x86 version on 64-bit linux machine (this is Ubuntu 16.04)

deepy commented 4 years ago

@paksv probably because it's a 32bit JVM being used. Can you check what ´os.arch´ is being reported by the JVM used by gradle? We've changed this in the fork to better support ARM but it's pretty simple in both cases. https://github.com/node-gradle/gradle-node-plugin/commit/3d33948b5fc38d30208d495290ec87722a31bdff

paksv commented 4 years ago

@deepy, thanks, it's indeed because of 32-bit jvm. I have worked around the issue by modifying the getOsArch() and using a locally built package. Would you like me to send a PR for the fix?

deepy commented 4 years ago

To be honest, I think this is Working As Intended. Your JVM is reporting 32-bit and 32-bit node is being requested.

If you're on a 64-bit system, why not use a 64-bit JVM?

Yachin commented 4 years ago

To be honest, I think this is Working As Intended. Your JVM is reporting 32-bit and 32-bit node is being requested.

If you're on a 64-bit system, why not use a 64-bit JVM?

Hi, I am having the same issue. Running in idea IntelliJ on my local 64 bits widows machine with 64bit JAVA. But it still looks for x86. What can I do to ask it to look for x64 folder? Thank you!

deepy commented 4 years ago

Does it work when you run Gradle from the command-line with a 64-bit JVM? If that doesn't work, check what os.arch is being reported and open an issue at the fork and I can have a look at it.

Yachin commented 4 years ago

Does it work when you run Gradle from the command-line with a 64-bit JVM? If that doesn't work, check what os.arch is being reported and open an issue at the fork and I can have a look at it.

Hi @deepy , thank you for the quick reply. I just started this job and am very new with gradle. This is how I check os.arch in gradle and it returns amd64 System.getProperty("os.arch"); How can I ask gradle to run 64-bit JVM through command line? Thank you so much!

deepy commented 4 years ago

Setting JAVA_HOME is probably the way to go there, but if os.arch returns amd64 you're supposed to get an x64 distribution of node, that's what's being used to determine which version to download.

Yachin commented 4 years ago

@deepy,

Thank you for the reply. Any recommendation I can get the code running on my Windows machine? Thank you.

Yachin

deepy commented 4 years ago

Use a 64bit JVM