Anyone have dealt with "Cannot run program "/home/...
# javascript
t
Anyone have dealt with "Cannot run program "/home/gradle/.gradle/nodejs/node-v14.17.0-linux-x64/bin/node" (in directory "/builds/mensapl/skill-matrix/skillmatrix-frontend-ci/skillmatrix-frontend/build/js"): error=2, No such file or directory"?
Found in logs:
Copy code
Resource missing. [HTTP GET: <https://gitlab.com/api/v4/groups/13857538/-/packages/maven/com/yarnpkg/yarn/1.22.10/yarn-1.22.10.pom>]
Resource missing. [HTTP GET: <https://repo.maven.apache.org/maven2/com/yarnpkg/yarn/1.22.10/yarn-1.22.10.pom>]
Downloading <https://github.com/yarnpkg/yarn/releases/download/v1.22.10/yarn-v1.22.10.tar.gz> to /home/gradle/.gradle/.tmp/gradle_download8773837698969354835bin
Resource missing. [HTTP GET: <https://gitlab.com/api/v4/groups/13857538/-/packages/maven/org/nodejs/node/14.17.0/node-14.17.0.pom>]
Resource missing. [HTTP GET: <https://repo.maven.apache.org/maven2/org/nodejs/node/14.17.0/node-14.17.0.pom>]
Downloading <https://nodejs.org/dist/v14.17.0/node-v14.17.0-linux-x64.tar.gz> to /home/gradle/.gradle/.tmp/gradle_download5757188404730352459bin
t
Works fine on GitHub actions
t
@turansky This one is from GitLab.
Copy code
image: gradle:alpine

variables:
  GRADLE_OPTS: "-Dorg.gradle.daemon=false"

stages:
  - clone 
  - build

clone:
  stage: clone
  script:
    - git clone --depth 1 <https://gitlab-ci-token>:${CI_JOB_TOKEN}@gitlab.com/smth.git
  artifacts:
    paths:
      - "smth/*"

build:
  stage: build
  dependencies: 
    - clone
  script: 
    - cd smth
    - chmod a+x gradlew
    - ./gradlew --build-cache build -PgitLabCiJobToken=${CI_JOB_TOKEN} --info --stacktrace
  cache:
    key: "$CI_COMMIT_REF_NAME"
    policy: push
    paths:
      - build
      - .gradle
t
Gradle 7.3.1?
t
Yes
t
Is it local problem? (on windows?)
t
No, linux docker "gradle:alpine" on GitLab.
"BUILD SUCCESSFUL" on Windows and WSL Ubuntu.
Ah, I'll check if "--build-cache" or "-Dorg.gradle.daemon=false" make the diffrence.
GRADLE_OPTS="-Dorg.gradle.daemon=false" ./gradlew clean build --build-cache
Still build succeeds on WSL. I may try on docker tomorrow.
Strange... ran it inside Docker locally and I'm getting the same error
Copy code
/builds/NiematojakTomasz/gradle-kotlin-npm-issue # ./gradlew build --build-cache
To honour the JVM settings for this build a single-use Daemon process will be forked. See <https://docs.gradle.org/7.3.1/userguide/gradle_daemon.html#sec:disabling_the_daemon>.
Daemon will be stopped at the end of the build

> Configure project :app
Kotlin Multiplatform Projects are an Alpha feature. See: <https://kotlinlang.org/docs/reference/evolution/components-stability.html>. To hide this message, add 'kotlin.mpp.stability.nowarn=true' to the Gradle properties.

org.gradle.language.jvm.tasks.ProcessResources_Decorated
Please choose a JavaScript environment to build distributions and run tests.
Not choosing any of them will be an error in the future releases.
kotlin {
    js {
        // To build distributions for and run tests on browser or Node.js use one or both of:
        browser()
        nodejs()
    }
}

> Task :assemble UP-TO-DATE
> Task :check UP-TO-DATE
> Task :build UP-TO-DATE
> Task :app:browserProcessResources NO-SOURCE
> Task :app:browserBrowserProductionExecutableDistributeResources NO-SOURCE
> Task :kotlinNodeJsSetup
> Task :kotlinYarnSetup
> Task :kotlinNpmCachesSetup
> Task :app:browserPackageJson
> Task :app:browserTestPackageJson
> Task :app:jsPackageJson
> Task :app:nodePackageJson
> Task :app:nodeTestPackageJson
> Task :rootPackageJson
> Task :kotlinNpmInstall FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':kotlinNpmInstall'.
> A problem occurred starting process 'command '/home/gradle/.gradle/nodejs/node-v14.17.0-linux-x64/bin/node''

* 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>

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See <https://docs.gradle.org/7.3.1/userguide/command_line_interface.html#sec:command_line_warnings>

BUILD FAILED in 14s
10 actionable tasks: 10 executed
/builds/NiematojakTomasz/gradle-kotlin-npm-issue # stat /home/gradle/.gradle/nodejs/node-v14.17.0-linux-x64/bin/node
  File: /home/gradle/.gradle/nodejs/node-v14.17.0-linux-x64/bin/node
  Size: 74253640        Blocks: 145032     IO Block: 4096   regular file
Device: 810h/2064d      Inode: 126630      Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2021-12-12 23:45:26.928344700 +0000
Modify: 2021-12-12 23:45:25.818344700 +0000
Change: 2021-12-12 23:45:25.968344700 +0000
/builds/NiematojakTomasz/gradle-kotlin-npm-issue # /home/gradle/.gradle/nodejs/node-v14.17.0-linux-x64/bin/node
sh: /home/gradle/.gradle/nodejs/node-v14.17.0-linux-x64/bin/node: not found
Switching to different image (openjdk:11) fixed the issue. Not sure if I could report issue with gradle image somewhere... it doesn't seems to be a Kotlin project project, as file exists with correct permissions, still we're not run it.
Copy code
/builds/NiematojakTomasz/gradle-kotlin-npm-issue # stat /home/gradle/.gradle/nodejs/node-v14.17.0-linux-x64/bin/node
  File: /home/gradle/.gradle/nodejs/node-v14.17.0-linux-x64/bin/node
  Size: 74253640        Blocks: 145032     IO Block: 4096   regular file
Device: 810h/2064d      Inode: 126630      Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2021-12-12 23:45:26.928344700 +0000
Modify: 2021-12-12 23:45:25.818344700 +0000
Change: 2021-12-12 23:45:25.968344700 +0000
/builds/NiematojakTomasz/gradle-kotlin-npm-issue # /home/gradle/.gradle/nodejs/node-v14.17.0-linux-x64/bin/node
sh: /home/gradle/.gradle/nodejs/node-v14.17.0-linux-x64/bin/node: not found
d
A little late to this but it’s because alpine uses musl libc instead of glibc, and the provided linux node binaries require glibc. It’s a very confusing error since even if the file exists it will say
not found
, but the actual problem is that the binary is not compatible with musl libc. See: https://stackoverflow.com/a/66974607
You could install node with apline’s package manager
apk
instead and then tell kotlin to use the system node instead of downloading one