Hi is there a sample project for a Nodejs executab...
# javascript
f
Hi is there a sample project for a Nodejs executable. I am trying to follow https://kotlinlang.org/docs/js-project-setup.html and when I run
./gradlew jsRun
I get the following in 🧵
Copy code
* What went wrong:
Configuration cache state could not be cached: field `apiConfiguration` of `org.jetbrains.kotlin.gradle.plugin.mpp.compilationImpl.DefaultKotlinCompilationConfigurationsContainer` bean found in field `dependencyConfigurations` of `org.jetbrains.kotlin.gradle.plugin.mpp.compilationImpl.KotlinCompilationImpl$Params` bean found in field `params` of `org.jetbrains.kotlin.gradle.plugin.mpp.compilationImpl.KotlinCompilationImpl` bean found in field `$$delegate_0` of `org.jetbrains.kotlin.gradle.plugin.mpp.KotlinCommonCompilation` bean found in field `underlying` of `org.jetbrains.kotlin.gradle.utils.MutableObservableSetImpl` bean found in field `compilations` of `org.jetbrains.kotlin.gradle.plugin.sources.DefaultKotlinSourceSet` bean found in field `value` of `org.jetbrains.kotlin.tooling.core.Extras$Entry` bean found in field `extras` of `org.jetbrains.kotlin.tooling.core.MutableExtrasImpl` bean found in field `extras` of `org.jetbrains.kotlin.gradle.plugin.mpp.compilationImpl.KotlinCompilationImpl` bean found in field `$$delegate_0` of `org.jetbrains.kotlin.gradle.plugin.mpp.KotlinJvmCompilation` bean found in field `map` of `org.gradle.api.internal.DefaultNamedDomainObjectCollection$UnfilteredIndex` bean found in field `index` of `org.gradle.api.internal.FactoryNamedDomainObjectContainer` bean found in field `compilations` of `org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget` bean found in field `target` of `org.jetbrains.kotlin.gradle.plugin.mpp.KotlinJvmCompilation` bean found in field `underlying` of `org.jetbrains.kotlin.gradle.utils.MutableObservableSetImpl` bean found in field `compilations` of `org.jetbrains.kotlin.gradle.plugin.sources.DefaultKotlinSourceSet` bean found in field `value` of `org.jetbrains.kotlin.tooling.core.Extras$Entry` bean found in field `extras` of `org.jetbrains.kotlin.tooling.core.MutableExtrasImpl` bean found in field `extras` of `org.jetbrains.kotlin.gradle.plugin.mpp.compilationImpl.KotlinCompilationImpl` bean found in field `$$delegate_0` of `org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrCompilation` bean found in field `compilation` of `org.jetbrains.kotlin.gradle.targets.js.npm.resolver.KotlinCompilationNpmResolver` bean found in field `byCompilation` of `org.jetbrains.kotlin.gradle.targets.js.npm.resolver.KotlinProjectNpmResolver` bean found in field `projectResolvers` of `org.jetbrains.kotlin.gradle.targets.js.npm.resolver.KotlinRootNpmResolver` bean found in field `resolver` of `org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension` bean found in field `nodeJs` of `org.jetbrains.kotlin.gradle.targets.js.ir.KotlinBrowserJsIr` bean found in field `value` of `kotlin.InitializedLazyImpl` bean found in field `browser$delegate` of `org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrTarget` bean found in field `this$0` of `org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrTarget$commonLazy$2$1$1` bean found in field `function` of `org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrTarget$sam$org_gradle_api_Action$0` bean found in field `val$action` of `org.gradle.configuration.internal.DefaultUserCodeApplicationContext$CurrentApplication$1` bean found in field `delegate` of `org.gradle.api.internal.DefaultCollectionCallbackActionDecorator$BuildOperationEmittingAction` bean found in field `val$action` of `org.gradle.api.internal.collections.CollectionFilter$1` bean found in field `multipleActions` of `org.gradle.internal.ImmutableActionSet$SetWithManyActions` bean found in field `addActions` of `org.gradle.api.internal.collections.DefaultCollectionEventRegister` bean found in field `eventRegister` of `org.gradle.api.internal.DefaultDomainObjectSet` bean found in field `$$delegate_0` of `org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsBinaryContainer` bean found in field `binaries` of `org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrCompilation` bean found in field `compilation` of task `:jsNodeDevelopmentRun` of type `org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsExec`: error writing value of type 'org.gradle.api.internal.artifacts.configurations.DefaultConfiguration'
> Resolving dependency configuration 'metadataCompilationApi' is not allowed as it is defined as 'canBeResolved=false'.
  Instead, a resolvable ('canBeResolved=true') dependency configuration that extends 'metadataCompilationApi' should be resolved.
My
build.gradle.kts
is
Copy code
plugins {
    alias(libs.plugins.kotlinMultiplatform)
}

kotlin {
    js {
        binaries.executable()
        nodejs()
    }
    jvm {
    }

    sourceSets {
        val commonMain by getting {
            dependencies {
            }
        }
        val commonTest by getting {
            dependencies {
                implementation(libs.kotlin.test)
            }
        }
        val jsMain by getting {
            dependencies {
                // implementation(npm("puppeteer", "^22.0.0"))
            }
        }
    }
}
Hmm got it working, not really sure what I did. I changed the Kotlin version to 1.9.20
c
Hey, the error you're getting is a configuration cache problem (it's a Gradle feature to make the build faster). It means there's a bug in one of the plugins you use, you can't fix this yourself. Since it got fixed when you upgraded the Kotlin version, it was probably a bug in the previous version of the Kotlin plugin you used. If you see this again, you can temporarily disable the configuration cache with
org.gradle.configuration-cache=false
in
gradle.properties
, but don't forget to report the problem to the Kotlin team so they can fix it for everyone.