JS target breaks build when importing from npm

When syncing with Android Studio a MPP project with a fairly easy build.gradle.kts:

import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler

plugins {
    kotlin("multiplatform") version "1.3.50"
}

kotlin {

    jvm()
    js()

    sourceSets {

        val ktorVersion: String by project
        val kodeinVersion: String by project
        val firebaseJsVersion: String by project

        all {
            dependencies {
                api("org.kodein.di:kodein-di-core:$kodeinVersion")
                api("org.kodein.di:kodein-di-erased:$kodeinVersion")
            }
        }

        val commonMain by getting {
            dependencies {
                api(project(":data"))
                api(ktor("client-core", ktorVersion))
            }
        }

        val jvmMain by getting {
            dependencies {
                api(project(":data"))
                api(ktor("client-core-jvm", ktorVersion))
            }
        }

        val jsMain by getting {
            dependencies {
                api(project(":data"))
                api(ktor("client-core-js", ktorVersion))
                api(npm("firebase", firebaseJsVersion)) // <-- this line breaks the build!
            }
        }
    }

}

@Suppress("unused")
fun KotlinDependencyHandler.ktor(module: String, version: String? = null): Any =
    "io.ktor:ktor-$module${version?.let { ":$version" } ?: ""}"

Error is:

Warning: project ':mpp-lib': Unable to build Kotlin project configuration
Details: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':mpp-lib:jsMainApiDependenciesMetadata'.
Caused by: java.lang.IllegalStateException: NPM project resolved without org.jetbrains.kotlin.gradle.targets.js.npm.KotlinNpmResolutionManager@affb87c

Warning: project ':mpp-lib': Unable to build Kotlin project configuration
Details: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':mpp-lib:jsMainApiDependenciesMetadata'.
Caused by: java.lang.IllegalStateException: NPM project resolved without org.jetbrains.kotlin.gradle.targets.js.npm.KotlinNpmResolutionManager@affb87c

The errors happens both with or without Gradle’s metadata enabled; I do not have Nodejs installed.
I’ve found no similar issues elsewhere.
Project available here.

EDIT:
When configuring the js target with a browser target, the error changes:

Warning: project ':mpp-lib': Unable to build Kotlin project configuration
Details: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':mpp-lib:jsMainApiDependenciesMetadata'.
Caused by: java.lang.IllegalStateException: 
yarn install v1.15.2
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Warning: project ':mpp-lib': Unable to build Kotlin project configuration
Details: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':mpp-lib:jsMainApiDependenciesMetadata'.
Caused by: java.lang.IllegalStateException: Check failed.

This is even more confusing :roll_eyes:

EDIT2:
Turns out that the project name was “My application” and the space in the name was causing yarn to go nuts! Of course the build still do not work but the error changed to:

> Task :mpp-lib:compileKotlinMetadata      
error Couldn't find any versions for "kotlin" that matches "%%%KOTLIN_VERSION!!!"

It is due to one multiplatform dependency misbuilding the package.json; here’s the issue on its GitHub page.