Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nodeSetup: Couldn't follow symbolic link. #313

Open
thSoft opened this issue Jun 5, 2024 · 5 comments
Open

nodeSetup: Couldn't follow symbolic link. #313

thSoft opened this issue Jun 5, 2024 · 5 comments

Comments

@thSoft
Copy link

thSoft commented Jun 5, 2024

Hi,

Sometimes the nodeSetup task is failing with the error
'Couldn't follow symbolic link.' on osx.

Cleaning the .gradle directory fixes the issue.

> Task :myproject:nodeSetup FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':magicdraw-oslc-delegated-dialog:nodeSetup'.
> Couldn't follow symbolic link '/Users/thsoft/myproject/.gradle/nodejs/node-v20.11.1-darwin-x64/bin/npx'.

(This is exactly the same problem as srs/gradle-node-plugin#190.)

Unfortunately I can't share my example and I can't reproduce this from a clean state, but I'll try to come up with a minimal example.

@deepy
Copy link
Member

deepy commented Jun 5, 2024

What version of the plugin are you using?
And when it fails, what does /Users/thsoft/myproject/.gradle/nodejs/node-v20.11.1-darwin-x64/bin/npx point to?

@thSoft
Copy link
Author

thSoft commented Jun 5, 2024

Thanks for reaching out!

Version:

plugins {
    id("com.github.node-gradle.node") version "7.0.2"
}

Symlink target:

/Users/thsoft/myproject/.gradle/nodejs/node-v20.11.1-darwin-x64/bin/npx -> /Users/thsoft/myproject/.gradle/nodejs/node-v20.11.1-darwin-x64/lib/node_modules/npm/bin/npx-cli.js

@DreierF
Copy link
Contributor

DreierF commented Oct 10, 2024

We are facing the same issue:

> Task :pnpmSetup FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':pnpmSetup'.
> A problem occurred starting process 'command 'npm''

Environment (in case it makes a difference):

  • macOS 15
  • Gradle 8.10.2 running on Java 21
  • nodejs is installed via homebrew
    • /opt/homebrew/bin is on the PATH
    • /opt/homebrew/bin/npm is a symlink to /opt/homebrew/Cellar/node/22.9.0/bin/npm
    • /opt/homebrew/Cellar/node/22.9.0/bin/npm is a symlink to /opt/homebrew/lib/node_modules/npm/bin/npm-cli.js

This task produces the same error:

tasks.register<Exec>("npmVersion") {
    environment = mapOf(Pair("PATH", "/opt/homebrew/bin"))
    commandLine = listOf("npm", "--version")
}

@deepy deepy added the macOS label Oct 28, 2024
@deepy
Copy link
Member

deepy commented Oct 28, 2024

I think you're hitting this Java 21 issue: gradle/gradle#10483 (comment)
And this is probably something that only should be fixed in Gradle, but since it's Java 21 we might need to work around it in the plugin 🥲

For the download = false scenario relying on path should be absolutely fine, either your system knows where the thing is or you need to tell it
But in the case of download = true we know where the binary should be, and relying on PATH just means we might be picking up the wrong thing

@deepy deepy removed the macOS label Oct 28, 2024
@xtermi2
Copy link

xtermi2 commented Oct 30, 2024

same issue here since version 7.0.2 (also on 7.1.0) - on Java 21 AND 17!
We use download = true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants