CLOVIS
01/07/2025, 8:27 PMval kotlinEnvironment = project.rootProject.kotlinNodeJsExtension // ⚠ deprecated
nodePath.set(
kotlinEnvironment
.requireConfigured() // ⚠ deprecated
.let { RegularFile { File(it.nodeExecutable) } } // ⚠ deprecated
)
I'd like to migrate this code to the new way. Basically all it does is find out where the Kotlin plugin installed NodeJS (because we have some other tools that need NodeJS with the exact same version as the Kotlin plugin is using).
From what I can gather:
• project.rootProject.kotlinNodeJsExtension
should be not use rootProject
anymore and should use an extension related to NodeJsPlugin
, but I can't find which exactly
• requireConfigured()
should be needed anymore because the new extension takes care of that itself (?)
• nodeExecutable
has been replaced by just executable
?
What am I missing?CLOVIS
01/07/2025, 8:35 PMval nodeJsEnvironment = project.extensions.getByType(NodeJsEnvSpec::class.java)
nodePath.set {
nodeJsEnvironment
.installationDirectory
.asFile.get()
}
but I'm getting
Unable to load class 'org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsEnvSpec'.
This is an unexpected error. Please file a bug containing the idea.log file.
Robert Jaros
01/07/2025, 8:35 PMCLOVIS
01/08/2025, 1:52 PMCLOVIS
01/08/2025, 1:53 PMEdoardo Luppi
01/09/2025, 10:48 AMIlya Goncharov [JB]
01/09/2025, 10:51 AMplugins.withType<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsPlugin> {
the<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsEnvSpec>().executable // Provider<String>
}
CLOVIS
01/10/2025, 6:41 PM.executable
field in 2.1.0Ilya Goncharov [JB]
01/10/2025, 6:44 PMCLOVIS
01/10/2025, 6:45 PMIlya Goncharov [JB]
01/13/2025, 10:28 AM@Suppress("DEPRECATION"
?CLOVIS
01/13/2025, 7:51 PMSkaldebane
02/12/2025, 8:16 PMCLOVIS
02/16/2025, 5:48 PMNodeJsEnvSpec.executable
does not seem to exist in 2.1.10. If I understand the GitHub correctly, it is in 2.1.20-Beta2?CLOVIS
04/18/2025, 5:57 PMorg.gradle.api.UnknownDomainObjectException: Extension of type 'NodeJsEnvSpec' does not exist. Currently registered extension types: [ExtraPropertiesExtension]
CLOVIS
04/18/2025, 6:18 PMCLOVIS
04/18/2025, 8:12 PM- Gradle detected a problem with the following location: '/home/ivan/.gradle/nodejs/node-v22.0.0-linux-x64/bin/node'.
Reason: Task ':app:viteBuild' uses this output of task ':core:kotlinNodeJsSetup' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
I'm confused why :core
would have a :kotlinNodeJsSetup
, I thought only the root module had that task?Shubham Singh
05/01/2025, 5:32 AMIlya Goncharov [JB]
05/01/2025, 8:46 AMCLOVIS
05/02/2025, 8:48 PM:app:viteBuild
uses a file generated by :core:kotlinNodeJsSetup
, so evidently they don't use separated installations.CLOVIS
05/02/2025, 8:49 PM:app:viteBuild
task declares a mustRunAfter
on each :xxx:kotlinNodeJsSetup
where :xxx
is each project that appears in the dependencies of :app