Headsup. I made a simple kotlin/js (nodejs) projec...
# javascript
a
Headsup. I made a simple kotlin/js (nodejs) project but when I run the main() I get:
Copy code
FAILURE: Build failed with an exception.

* What went wrong:
A problem was found with the configuration of task ':jsDevelopmentExecutableCompileSync' (type 'DefaultIncrementalSyncTask').
  - Gradle detected a problem with the following location: '/Users/alexstyl/projects/KotlinJs/build/js/packages/KotlinJs/kotlin'.
    
    Reason: Task ':jsNodeProductionRun' uses this output of task ':jsDevelopmentExecutableCompileSync' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
    
    Possible solutions:
      1. Declare task ':jsDevelopmentExecutableCompileSync' as an input of ':jsNodeProductionRun'.
      2. Declare an explicit dependency on ':jsDevelopmentExecutableCompileSync' from ':jsNodeProductionRun' using Task#dependsOn.
      3. Declare an explicit dependency on ':jsDevelopmentExecutableCompileSync' from ':jsNodeProductionRun' using Task#mustRunAfter.
    
    For more information, please refer to <https://docs.gradle.org/8.4/userguide/validation_problems.html#implicit_dependency> in the Gradle documentation.
It gets resolved if I add to `build.gradle.kts`:
Copy code
tasks.named("jsDevelopmentExecutableCompileSync") {
    dependsOn("jsNodeProductionRun")
    mustRunAfter("jsNodeProductionRun")
}
Seems like a bug EDIT: Ended up removing the code above and run it with
./gradlew jsNodeRun
instead. works without an issue now
t
Which Node.js declarations do you use?
a
im not sure i understand the question. where do i see that?
t
From which library you import Node.js declarations?
a
still dont get it. I have node installed on my machine and in my build.gradle.kts i have
Copy code
kotlin {
    jvm()
    js {
        nodejs()
        binaries.executable()
    }
t
What you have in
dependencies
block?
a
I dont have a dependencies block
t
Do you write Node.js declarations yourself?
FYI - in Kotlin Wrappers we have kotlin-node, which contains Node.js declarations