https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
d

Damiano Giusti

04/04/2020, 7:47 PM
I receive the following error:
Copy code
Could not find method npm() for arguments [cheerio] on object of type org.jetbrains.kotlin.gradle.plugin.mpp.DefaultKotlinDependencyHandler.
I’m using the Groovy DSL
p

p2000t

04/05/2020, 12:27 PM
Hi Damiano, if I understand things correctly, then the syntax you use only works in Kotlin Gradle files (build.gradle.kts). If you use the Groovy DSL, you have to add npm dependencies on source sets using:
Copy code
kotlin {
    sourceSets["jsMain"].dependencies {
        implementation(npm("cheerio","1.2.3"))
    }
}
For more details, see: https://discuss.kotlinlang.org/t/npm-dependencies-with-kotlin-1-3-40/13174
d

Damiano Giusti

04/05/2020, 12:27 PM
Thanks @p2000t I’ll try to migrate to kts asap and then i’ll let you know
3 Views