how can I configure KMP to stop downloading the no...
# multiplatform
a
how can I configure KMP to stop downloading the nodejs and yarn? I am on behind the corporate proxy and cannot download from https://nodejs.org. Tried configuring with `gradle.properties`:
Copy code
kotlin.js.nodejs.nodeJsArgs=
kotlin.js.nodejs.download=false
kotlin.js.yarn=false
kotlin.js.yarn.download=false
tried in
buildk.gradle.kts
, programmatically:
Copy code
allprojects {
    project.plugins.withType<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsPlugin> {
        project.the<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsEnvSpec>().download = false
    }
    rootProject.plugins.withType<org.jetbrains.kotlin.gradle.targets.js.yarn.YarnPlugin> {
        project.the<org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootEnvSpec>().download = false
    }
}
still it tries to download it ๐Ÿ˜ž
โž• 1
Copy code
org.jetbrains.kotlin.multiplatform
is 2.2.21.
a
@Ilya Goncharov [JB] @Adam Semenenko ^^
i
If you have
wasm
target, try to add
Copy code
project.plugins.withType<org.jetbrains.kotlin.gradle.targets.wasm.nodejs.WasmNodeJsPlugin> {
        project.the<org.jetbrains.kotlin.gradle.targets.wasm.nodejs.WasmNodeJsEnvSpec>().download = false
    }
    rootProject.plugins.withType<org.jetbrains.kotlin.gradle.targets.wasm.yarn.WasmYarnPlugin> {
        project.the<org.jetbrains.kotlin.gradle.targets.wasm.yarn.WasmYarnRootEnvSpec>().download = false
    }
a
@Ilya Goncharov [JB] the NodeJS worked with:
Copy code
allprojects {
    project.plugins.withType<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsPlugin> {
        the<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsEnvSpec>().download = false
    }
(no
project.
prefix) So now I have only issues with yarn:
Copy code
* What went wrong:
Failed to apply plugin class 'org.jetbrains.kotlin.gradle.targets.wasm.yarn.WasmYarnPlugin'.
> Extension of type 'WasmYarnRootEnvSpec' does not exist. Currently registered extension types: [ExtraPropertiesExtension, LibrariesForLibs, VersionCatalogsExtension, RootProjectAccessor, KotlinJvmProjectExtension, KotlinTestsRegistry, BasePluginExtension, SourceSetContainer, ReportingExtension, JavaToolchainService, JavaPluginExtension, TestingExtension, DistributionContainer, JavaApplication, ScriptingExtension]
โ˜๏ธ error with:
Copy code
allprojects {
    project.plugins.withType<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsPlugin> {
        the<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsEnvSpec>().download = false
    }

    rootProject.plugins.withType<org.jetbrains.kotlin.gradle.targets.wasm.yarn.WasmYarnPlugin> {
        project.the<org.jetbrains.kotlin.gradle.targets.wasm.yarn.WasmYarnRootEnvSpec>().download = false
    }
}
when I remove the rootProject leaving the:
Copy code
plugins.withType<org.jetbrains.kotlin.gradle.targets.wasm.yarn.WasmYarnPlugin> {
        the<org.jetbrains.kotlin.gradle.targets.wasm.yarn.WasmYarnRootEnvSpec>().download = false
    }
then yarn is downloaded, and failing to do so, because it tries the 'https://github.com/yarnpkg/yarn/releases/download/v1.22.17/yarn-v1.22.17.tar.gz', and I am forced to use corporate artifactory. Maybe you know how to configure the download url, or other way to disable it?
maybe worth to mention that gradle.properties:
Copy code
systemProp.org.nodejs.download.base.url
systemProp.org.nodejs.download.host
do not work as well
a
Where did you see those Gradle properties? I can't find any reference to them, either in Kotlin docs or on GitHub. I'm guessing they're a LLM hallucination? EDIT: Ah, I see
kotlin.js.yarn=false
here https://kotlinlang.org/docs/js-project-setup.html#npm-dependencies
a
they could be ๐Ÿ™‚ I didn't check if they are. I got my project.plugins.withType<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsPlugin> from some docs though. The nodejs download url looks suspicious, I wouldn't be surprised if it's an hallucination ๐Ÿ˜‰ Disabling (commenting out) the wasmJs {} didn't help, it still tries to download yarn and fails. ๐Ÿ˜ž
the documentation lack more information about the wasm, and the IntelliJ didn't download the source of that files, I also wasn't able to find the right config ๐Ÿ˜ž
a
sorry about that, we should try and improve it. Please can you make an issue and attach your project, or a smaller reproducer? It would really help us to see all the configuration, because it's hard to imagine what the problem could be. https://kotl.in/issue
๐Ÿ‘ 1
a
@Adam Semenenko, I've pushed https://github.com/Augustyn/wasm-download-example It obviously won't compile, as you must add your mirror maven repository, but it illustrate the issue: I cannot download anything from maven central, github, etc. Only mirror is whitelisted.
a
that's brilliant, thanks. At first glance it's not clear what's wrong, so I'd need to look further. Please make an issue https://kotl.in/issue otherwise we'll lose track of this.
a
I've created the https://youtrack.jetbrains.com/issue/KT-82042/KMP-yarn-always-use-public-repo-using-WasmJS Though I am not sure if I should select kotlin, the KPM tooling seems for Intellij, and Kotlin multiplatform compose for compose components blob thinking fast