Still doesn't work in `1.3.70`
# multiplatform
e
Still doesn't work in
1.3.70
Copy code
There was a failure while populating the build operation queue: NPM project resolved without org.jetbrains.kotlin.gradle.targets.js.npm.KotlinNpmResolutionManager@1e3aed99
NPM project resolved without org.jetbrains.kotlin.gradle.targets.js.npm.KotlinNpmResolutionManager@1e3aed99
b
Did you apply
kotlin.js
or
kotlin.multiplatform
? Because top level npm dependencies are only available when applying
kotlin.js
plugin.
e
When I add plugin, I get error 😃
Copy code
Build file 'H:\Projects\wf-mobile\Server\admin-tool\build.gradle.kts' line: 6

Error resolving plugin [id: 'org.jetbrains.kotlin.js', version: '1.3.70']
> Plugin request for plugin already on the classpath must not include a version
b
Just remove the version
I imagine this is multi-module project and you've declared kotlin plaugin version somewhere further down the root
e
That's true
Removing version produces same error
b
Any chance I could have a look at the repo? Hard to pinpoint the issue without context
e
Sorry, that's corporate project under NDA, etc. But I can share root
build.gradle.kts
in a minute...
b
Understandable. Can you share all files where you mention kotlin version, then?
e
That is the root.
b
remove line 49
And then apply kotlin subprojects directly
Because this line applies JVM plugin which denies the application of JS plugin in submodule
e
which denies the application of JS plugin
Oh, didn't know that
b
Or alternatively you can do something like this in the root to exclude js module
Copy code
subprojects.filter{it.name != "<js module name>"}
That way you can still config all modules except js as you did without interfering with it
Looking at how much JVM-specific config you;re doing on root it's probably best to go with the filtering option.
e
And I suppose that I have to use
multiplatform
plugin instead of
js
, because I have to compile server to jvm bytecode and web interface to javaScript
b
No need.
Just filter our js module from your subprojects config on root
Which will let you do whatever you want on that module freely
e
I think we have bad architecture 😃
Probably web interface should really be a separate module
Right now we have ktor server and javascript files in the same module (
admin-tool
)
b
Oof
Yes
You need to separate those out into modules
e
Thank you for your help! I appreciate it 😃
b
Did you manage to resolve the issue?
e
I cannot do it right away because of the mess in admin-tool. I've started with the wrong stuff -
npm()
is the least problem now
😄 1
b
For immediate fix keep the modules as they are and just filter out js module from the root submodules config
👍 1
r
Are you trying to use Java libraries and npm dependencies in the same project? What do you expect from that?
e
no to both questions 😃
r
Oh, I see, you are willing to add one js submodule to the project where all submodules are jvm right now?
Yeah, migration to multiplatform plugin would be the best option in long term, and filtering sounds like the way to go right now. Sorry for missing the point 🙂
e
Yes, I need to make a separate kotlin to js module for web client and a separate kotlin to jvm (ktor) server. Right now we have mixed web client and server in a single module and that's what I need to refactor in the future
I wanted to eat this whole problem in small chunks and start with integrating
npm
into gradle scripts. Right now we download javascript libraries manually and push them into our local source control which is a bad practice.
l
Your project's classpath is still on 1.3.61 or lower, possibly because of buildSrc or buildscript dependency, possibly transitive.
e
That’s not the case
l
Are you using
kotlin("js")
something different?