node-gradle / node-gradle/gradle-node-plugin

How to run unofficial node node-v18.16.1-linux-x64-musl.tar.gz on alpine?

Open
#294 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug musl / nixos / alpine
Dominant language
Groovy
Stars
677
Forks
120
PR merge metrics
No merged PRs in 30d

Description

I want to use gradle-node-plugin to install node on alpine linux. Using this advice https://github.com/node-gradle/gradle-node-plugin/issues/51#issuecomment-623097695 combined with this https://github.com/node-gradle/gradle-node-plugin/blob/main/docs/faq.md#is-this-plugin-compatible-with-centralized-repositories-declaration I managed to get a working configuration that downloads the correct binary package from https://unofficial-builds.nodejs.org/download/release/v18.16.1/node-v18.16.1-linux-x64-musl.tar.gz

build.gradle:

node {
	download = true
	version = "18.16.1"
	distBaseUrl = null;
	}
}

settings.gradle

dependencyResolutionManagement {
    repositories {
        repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)

        // Declare the Node.js download repository
        ivy {
            name = "Node.js"
            setUrl("https://unofficial-builds.nodejs.org/download/release/")
            patternLayout {
                artifact("v[revision]/[artifact](-v[revision]-linux-x64-musl).[ext]")
            }
            metadataSources {
                artifact()
            }
            content {
                includeModule("org.nodejs", "node")
            }
        }
    }
}

However, npmInstall fails since it tries to look for the binary in the wrong directory. Can I do something to fix this?

> Task :clean
> Task :nodeSetup
> Task :npmSetup SKIPPED
> Task :npmInstall FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':npmInstall'.
> A problem occurred starting process 'command '/mydir/frontend/.gradle/nodejs/node-v18.16.1-linux-x64/bin/node''

Binary is in node-v18.16.1-linux-x64-musl, not in node-v18.16.1-linux-x64.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the build.gradle and settings.gradle configuration, then trace the nodeSetup and npmInstall tasks and the .gradle/nodejs installation path. Compare the expected node-v18.16.1-linux-x64 directory with the downloaded node-v18.16.1-linux-x64-musl archive; done means npmInstall starts the downloaded binary successfully on Alpine.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy, node.js
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.