gpt4 book ai didi

kotlin - 未捕获的 TypeError : Kotlin. defineModule 不是函数

转载 作者:行者123 更新时间:2023-12-02 01:02:15 25 4
gpt4 key购买 nike

我正在使用 Kotin for JavaScript 和 create-react-kotlin-app CLI 开发一个 Web 应用程序。当我昨天推送我的代码时,一切正常。但是当我今天再次启动它时,我收到了这个错误:

Uncaught TypeError: Kotlin.defineModule is not a function
at C:\src\main\kotlin\kotlinext\js\Object.kt:20
at Object.<anonymous> (C:\src\main\kotlin\kotlinext\js\Object.kt:20)
at __webpack_require__ (C:\my_workspace\bwa-js\webpack\bootstrap e6d8ae87c0ef02bf2708:678)
at fn (C:\my_workspace\bwa-js\webpack\bootstrap e6d8ae87c0ef02bf2708:88)
at Object.map../index/index.css (C:\src\ui\tabbar\workout\changeWorkout\ChangeWorkoutPage.kt:90)
at __webpack_require__ (C:\my_workspace\bwa-js\webpack\bootstrap e6d8ae87c0ef02bf2708:678)
at fn (C:\my_workspace\bwa-js\webpack\bootstrap e6d8ae87c0ef02bf2708:88)
at Object.<anonymous> (C:\my_workspace\bwa-js\stream.kt:137)
at __webpack_require__ (C:\my_workspace\bwa-js\webpack\bootstrap e6d8ae87c0ef02bf2708:678)
at module.exports (C:\my_workspace\bwa-js\webpack\bootstrap e6d8ae87c0ef02bf2708:724)
at C:\my_workspace\bwa-js\webpack\bootstrap e6d8ae87c0ef02bf2708:724

昨天一切正常,我的代码没有任何变化。我做了一个 git status确保;确定。

下面是错误来自的文件。我用注释标记了该行。它是最后一行之前的第 3 行。
package ui.tabbar.workout.changeWorkout

import external.onsenui.Ons
import external.onsenui.OnsNav
import kotlinext.js.js
import kotlinx.html.style
import model.Workout
import react.RBuilder
import react.dom.div
import service.state.WorkoutStateService

private lateinit var navigator: OnsNav

fun RBuilder.changeWorkoutPage(_navigator: OnsNav) {
navigator = _navigator
Ons.Page {
attrs {
key = "ChangeWorkoutPage"
renderToolbar = this@changeWorkoutPage.renderToolbar
}
Ons.List {
attrs {
dataSource = WorkoutStateService.workouts.toTypedArray()
renderRow = renderListItem
}
}
}
}

private val RBuilder.renderToolbar: Function<Any>
get() = {
Ons.Toolbar {
attrs {
modifier = "material"
}
div("left") {
Ons.BackButton {
attrs {
onClick = {
navigator.popPage()
}
}
}
}
div("center") {
attrs {
style = js {
textAlign = "center"
}
}
+"Workouts"
}
div("right") {
Ons.Icon {
//placeholder to center text in the center div
}
}
}
}

private val RBuilder.renderListItem
get() = { row: Workout, index: Int ->
Ons.ListItem {
attrs {
key = row.name + index
className = "workoutDaysListItem"
tappable = true
onClick = {
setCurrentWorkout(row)
navigator.popPage()
}
}
Ons.Card {
attrs {
className = "workoutDaysListCard"
}
div("innerWorkoutDaysListCard") {
div {
+row.name
}
div {
+"${row.dayList.size} days"
}
}

}
}
}

private val setCurrentWorkout = { workout: Workout -> //The error is here
WorkoutStateService.currentWorkout = workout
}

任何帮助将不胜感激。

最佳答案

我最终在这里找到了答案 https://github.com/JetBrains/create-react-kotlin-app#npm-start-or-yarn-start

里面说要删除.cache文件夹在 node_modules .我不得不再做一步,即清除浏览器缓存。

即使我在打开开发工具的情况下使用 Chrome 并且选中了“不使用缓存”选项,我仍然必须手动清除缓存。

关于kotlin - 未捕获的 TypeError : Kotlin. defineModule 不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49765556/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com