We are in the process of moving away from the fron...
# javascript
m
We are in the process of moving away from the frontend plugin to the new JS plugin. Everything works fine for a while, but then compiles in IntelliJ starts failing with the stacktrace below. The error and the warnings about invalid Kotlin Javascript libraries goes away for a while if the .idea folder is deleted and IntelliJ restarted. However, after some time it reappears. Has anyone had a similar problem, and know of a way to solve it?
InformationK kotlinc-js 1.4-M1 (JRE 1.8.0_232-b09)
Information:19/05/2020 16.15 - Build completed with 1 error and 28 warnings in 10 s 86 ms
ErrorK [Internal Error] java.io.IOException: Failed to open zip file: C:\Work\hltv\build\js\node_modules\jquery\dist\jquery.js
at org.jetbrains.kotlin.utils.JsLibraryUtils.traverseArchive(JsLibraryUtils.kt:118)
at org.jetbrains.kotlin.utils.JsLibraryUtils.copyJsFilesFromZip(JsLibraryUtils.kt:102)
at org.jetbrains.kotlin.utils.JsLibraryUtils.copyJsFilesFromLibraries(JsLibraryUtils.kt:43)
at org.jetbrains.kotlin.jps.targets.KotlinJsModuleBuildTarget.copyJsLibraryFilesIfNeeded(KotlinJsModuleBuildTarget.kt:127)
at org.jetbrains.kotlin.jps.targets.KotlinJsModuleBuildTarget.doAfterBuild(KotlinJsModuleBuildTarget.kt:121)
at org.jetbrains.kotlin.jps.build.KotlinBuilder.doBuild(KotlinBuilder.kt:457)
at org.jetbrains.kotlin.jps.build.KotlinBuilder.build(KotlinBuilder.kt:309)
at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1414)
at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:1092)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1159)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:1053)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:882)
at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:449)
at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:190)
at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:138)
at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:297)
at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:130)
at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:218)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:225)
at java.util.zip.ZipFile.<init>(ZipFile.java:155)
at java.util.zip.ZipFile.<init>(ZipFile.java:126)
at org.jetbrains.kotlin.utils.JsLibraryUtils.traverseArchive(JsLibraryUtils.kt:116)
... 20 more
WarningK 'C:/Work/hltv/build/js/node_modules/jquery/dist/jquery.js' is not a valid Kotlin Javascript library
WarningK 'C:/Work/hltv/build/js/node_modules/moment-timezone/index.js' is not a valid Kotlin Javascript library
WarningK 'C:/Work/hltv/build/js/node_modules/moment/moment.js' is not a valid Kotlin Javascript library
WarningK 'C:/Work/hltv/build/js/node_modules/react-sortable-hoc/dist/react-sortable-hoc.js' is not a valid Kotlin Javascript library
WarningK 'C:/Work/hltv/build/js/node_modules/regenerator-runtime/runtime.js' is not a valid Kotlin Javascript library
i
Do you use both Gradle and IntelliJ build system?
m
Yes, I do builds in a prompt using gradle, and in the IntelliJ build system. Your question gave me an idea to test something, based on when the error occured the last time. It seems that changing the IntelliJ setting "Build and run using" from "Gradle" to "IntelliJ IDEA" causes the error to appear.
i
And what do your purpose? Do you want build with intelliJ or build with Gradle is enough for you? For now we recommend to use Gradle builds, but we can investigate problem with IntelliJ build system too. You can test gradle build with command line
./gradlew build
or run task in Gradle tool bar in IDEA
m
I've had no problems building from the command line. Our setup has been using non-delegated builds up until now, and e.g. our ktor hot-reload watch configuration was based on this. I was not aware that the javascript/multiplatform plugins would not work with non-delegated builds. We'll switch to delegated builds and make the necessary changes. Thank you for the quick feedback.
a
Sorry if I'm thread-jacking, but is there a place that lists the differences between running with Gradle vs running with IntelliJ? Just want to make sure I understand the tradeoffs
i
I am mot sure about such list, but run with IntelliJ build system (so called JPS) provide basic functionality with compilation only. There is no additional tooling with integration with some JavaScript ecosystem stuff (karma, webpack for example).