Open jschneider opened 5 months ago
Since caching is not enabled we can rule out Gradle writing to the directory
And unless your subprojects are installing to the same node_modules
we can rule out the plugin as well
Which then sadly would leave pnpm, you can work around the issue by using a shared build service as a semaphore, limiting the number of installs that can run in parallel
But before going down that route, just to confirm, all the pnpm installs aren't writing to /home/johannes/projects/com.cedarsoft.monorepo/node_modules/
right?
The pnpm install tasks are writing all to the same node_modules dir in the project root. We have a pnpm "monorepo" with a pnpm-workspace.yaml
I'm running into this as well with a similar project set up. Here's my workaround that I added in my root build.gradle.kts
.
// Ensures that only one PnpmInstallTask runs at a time. The build service acts as a semaphore.
class EmptyBuildService : BuildService<BuildServiceParameters.None> {
override fun getParameters(): BuildServiceParameters.None = TODO("Not yet implemented")
}
val service = gradle.sharedServices
.registerIfAbsent("pnpmInstallService", EmptyBuildService::class) {
maxParallelUsages = 1
}
subprojects {
tasks.withType<PnpmInstallTask>().configureEach {
usesService(service)
}
}
I get these exceptions when calling
gradle pnpmInstall
from my project root (with several sub projects configured for pnpm):The exact error message changes every time:
ERR_PNPM_LINKING_FAILED Error: ENOTEMPTY: directory not empty, rmdir '/home/johannes/projects/com.cedarsoft.monorepo/node_modules/.pnpm/shikiji@0.9.19/node_modules/shikiji/dist/langs'
ERR_PNPM_LINKING_FAILED Error: ENOTEMPTY: directory not empty, rename '/home/johannes/projects/com.cedarsoft.monorepo/node_modules/.pnpm/postcss-calc@8.2.4_postcss@8.4.33/node_modules/postcss-calc_tmp_15783' -> '/home/johannes/projects/com.cedarsoft.monorepo/node_modules/.pnpm/postcss-calc@8.2.4_postcss@8.4.33/node_modules/postcss-calc'
The exception does not happen if adding "--no-parallel".