I was doing the tutorial for React Kotlin and couldnt even finish the setup step because the server does not start.

The code is unchanged : https://github.com/kotlin-hands-on/web-app-react-kotlin-js-gradle

Stacktrace:

[webpack-cli] Unable to load '@webpack-cli/serve' command
[webpack-cli] TypeError: options.forEach is not a function
[webpack-cli] TypeError: options.forEach is not a function

我看到了这个问题:https://github.com/webpack/webpack-cli/issues/2990,但我无法实施建议的修复(更改webpack cli版本,并从Thread.lock中删除webpack cli/serve),因为我在kotlin js gradle插件上找不到如何更改这些.

Even simple browser application from intelliJ is broken with the same error.

推荐答案

Try to update webpack-cli:

rootProject.plugins.withType(org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin::class.java) {  
    rootProject.the<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension>().versions.webpackCli.version = "4.9.0"
}

Kotlin相关问答推荐

当通过firstOrders访问时,存储在伴随对象中的对象列表具有空值

Kotlin和JavaFX:绑定行为奇怪

在KMM合成多平台中创建特定于平台的视图

在Webflux应用程序中通过kotlin协程启动fire and forget job

使用另一个对象的列表创建对象

Microronaut Data 4和JDbi

T和T有什么区别:任何>

try 一次性插入多条记录时,JOOQ连接为空错误

在 Kotlin 中 import 如何找到文件路径?

Kotlin 列表扩展功能

为什么 Kotlin 需要函数引用语法?

Map.mapTo 到另一个map

无法创建类 ViewModel kotlin 的实例

带有迭代器函数的 Kotlin 无限序列

当被Spring代理类访问时,Kotlin实例变量为null

在 Kotlin 中创建 Spinner 时,如何在 Fragment 中的旋转屏幕上修复指定为非空的参数为空?

在kotlin中初始化类变量的正确位置是什么

Android:Exoplayer - ExtractorMediaSource 已弃用

判断EditText是否为空kotlin android

Kotlin for assertThat(foo, instanceOf(Bar.class))