I'm building a Compose Multiplatform app targeting...
# compose
y
I'm building a Compose Multiplatform app targeting Kotlin-Wasm alongside Android/iOS/Desktop. When calling REST API methods using the Ktor client in the Wasm target, I encounter the error: ⚠️ Node.js net module is not available. Please verify that you are using Node.js .
my ktor version is 3.1.0
and
compose version is 1.7.3
. Below are my setup details and current configuration: Dependencies (commonMain):
Copy code
implementation(libs.ktor.client.core)  
 implementation(libs.ktor.client.content.negotiation)  
 implementation(libs.ktor.serialization.kotlinx.json)  
 implementation(libs.ktor.client.cio)
Koin DI Configuration:
Copy code
single {
     Json {
         ignoreUnknownKeys = true
         isLenient = true
         encodeDefaults = false // Match API expectations [[8]]
     }
 }
 
 // 2. HTTP Client Configuration
 single<HttpClient> {
     HttpClient(CIO) {
         engine {
             requestTimeout = 0
         }
         // Specify engine explicitly [[1]][[4]]
         install(ContentNegotiation) {
             json(
                 json = get(), // Use shared JSON instance
                 contentType = ContentType.Application.Json
             )
         }
     }
How could I fix this?
after removing CIO engine from HTTP Client Configuration and run the app again. I still get this error: Uncaught runtime errors:
Copy code
ERROR
wasm validation error: at offset 5557696: type mismatch: expression has type (ref null 1950) but expected externref
. here is the repository link for more context: https://github.com/yassineAbou/LLMS
m
I don't know how what the answer is, but maybe ask in #C0A974TJ9 since this is not related to compose.
y
Ok, thanks