近期我的mirai机器人启动时遇到这个问题,表现为机器人的http API接口的端口无法连接,mirai机器人启动时出错。
2021-09-15 14:33:15 E/Mirai HTTP API: java.lang.NoSuchMethodError: 'double kotlin.time.DurationKt.toDuration(int, java.util.concurrent.TimeUnit)'
java.lang.NoSuchMethodError: 'double kotlin.time.DurationKt.toDuration(int, java.util.concurrent.TimeUnit)'
at net.mamoe.mirai.api.http.route.BaseRouteKt$mirai$2.invoke(BaseRoute.kt:48)
at net.mamoe.mirai.api.http.route.BaseRouteKt$mirai$2.invoke(BaseRoute.kt)
at io.ktor.features.CORS$Feature.install(CORS.kt:517)
at io.ktor.features.CORS$Feature.install(CORS.kt:509)
at io.ktor.application.ApplicationFeatureKt.install(ApplicationFeature.kt:68)
at net.mamoe.mirai.api.http.route.BaseRouteKt.mirai(BaseRoute.kt:45)
at net.mamoe.mirai.api.http.MiraiHttpAPIServer$start$2$1$1.invoke(MiraiHttpAPIServer.kt:93)
at net.mamoe.mirai.api.http.MiraiHttpAPIServer$start$2$1$1.invoke(MiraiHttpAPIServer.kt:29)
at io.ktor.server.engine.ApplicationEngineEnvironmentReloading.instantiateAndConfigureApplication(ApplicationEngineEnvironmentReloading.kt:303)
at io.ktor.server.engine.ApplicationEngineEnvironmentReloading.createApplication(ApplicationEngineEnvironmentReloading.kt:138)
at io.ktor.server.engine.ApplicationEngineEnvironmentReloading.start(ApplicationEngineEnvironmentReloading.kt:270)
at io.ktor.server.cio.CIOApplicationEngine$serverJob$1$1.invokeSuspend(CIOApplicationEngine.kt:53)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
自己尝试重启docker和重建docker均无法解决,经过网络搜索,找到了问题原因和解决方法。
来自githubSinCerely023
:
个人认为是mcl没有更新2.0版本mah但是mirai-console更新到了最新版本导致的问题。另外提醒一下最新版本的Graia有bug且无法适配mah 2.0,适当回退版本。
先通过以下命令指定特定版本的mcl,再重新启动mcl:
./mcl --update-package net.mamoe:mirai-console --channel stable --version 2.5.0