Closed cerbenus closed 1 year ago
Once I set:
download = true
Yarn started to work as expected.
What am I doing wrong in the globally accessible case (download = false)?
Which version of yarn do you have globally?
This example builds fine for me on Windows
C:\Users\deepy>where yarn
C:\Users\deepy\AppData\Roaming\npm\yarn
C:\Users\deepy\AppData\Roaming\npm\yarn.cmd
C:\Users\deepy>yarn --version
1.22.10
> gradle -p examples/simple-node helloWorld
> Task :yarn:yarnSetup
changed 1 package in 655ms
..
> Task :yarn:yarn
yarn install v1.22.19
warning package.json: No license field
warning example@0.0.0: No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 0.10s.
..
BUILD SUCCESSFUL in 12s
13 actionable tasks: 8 executed, 5 up-to-date
It sounds like there could be a bug with yarnWorkDir
, but I couldn't trigger it through the example
My recommendation would be not setting yarnWorkDir
and just leave the default setting
There is nodeProjectDir
if you need to build from elsewhere but the setup I'd recommend is keeping build.gradle(.kts) next to your package.json
(or similar)
I don't have Yarn installed globally. I thought the plugin downloads Yarn no matter what. Hence, why would I need a global installation?
usage.md states:
The plugin never uses a locally-installed yarn because it may be deleted during yarn execution. Instead, it installs yarn into yarnWorkDir (.gradle/yarn/ by default) by the yarnSetup task and use it.
I'm using:
// Version of Yarn to use // Any Yarn task first installs Yarn in the yarnWorkDir // It uses the specified version if defined and the latest version otherwise (by default) yarnVersion = ""
My build.gradle is next to package.json
I uninstalled the wrong yarn, running completely without yarn this too fails for me and the bug goes basically all the way back. This is conceptually a pretty easy change, though I do worry that it may break someone's workflow around yarn 2/3
But right now we don't have support for yarn 2/3, will debate whether this is a major change or a patch while I have dinner and wait for the tests to pass on CI
@cerbenus this is fixed in 7.0.0 which has now been released
I tried 7.0.0. While I can confirm that I don't have a "yarn problem" anymore, I can tell that the .gradle/yarn folder doesn't get created anymore even though the config comment states:
// Any Yarn task first installs Yarn in the yarnWorkDir
I'm trying out the just released version 6.0.0 and when executing gradle yarn I get:
The documentation says:
The plugin never uses a locally-installed yarn because it may be deleted during yarn execution. Instead, it installs yarn into yarnWorkDir (.gradle/yarn/ by default) by the yarnSetup task and use it.
After executing yarnSetup and checking the yarnWorkDir I find a sub folder under "yarn" called "yarn-latest". The yarn.cmd is available but somewhere the referencing must be off...
I do run a Gradle multi module project and therefore use a sub folder called "frontend" from which I'm running these commands.
I have specified my yarnWorkDir as:
// The directory where yarn is installed (when a Yarn task is used) yarnWorkDir = file("${project.projectDir}/.gradle/yarn")
project.projectDir points to sub module.