https://kotlinlang.org logo
#compose-web
Title
# compose-web
с

Стефан Јовановић

02/02/2023, 6:50 PM
I've made a new project using the default template for a Compose Web from the Intelij IDEA. I get some generated code that represents a simple counter web page. However when I run that project with the jsBrowserRun command, I get this error: Cannot find module 'D:\Ktor\Testing\build\js\node_modules\upath\build\code\upath.js'. Please verify that the package.json has a valid "main" entry
o

Oleksandr Karpovich [JB]

02/03/2023, 11:26 AM
I tried the template as is with 2 different version (compose 1.2.2 - kotlin 1.7.20, compose 1.3.0 - kotlin 1.8.0), gradle-7.5.1 and it works. Did you add any changes to the project? Or does it fail for you right away?
I checked my build/js/node_modules folder and I can see upath.js there. Could you please check if it’s really absent in your project/build folder?
с

Стефан Јовановић

02/03/2023, 1:54 PM
Nope, I don't see that file, nor directory named 'code' within the build folder.
o

Oleksandr Karpovich [JB]

02/03/2023, 1:56 PM
What if you create a simple k/js project from a template? w/o compose. Will it fail too? Compose shouldn’t affect those modules anyway. My guess is that the modules had not properly synced up.
с

Стефан Јовановић

02/03/2023, 2:06 PM
I've just created a simple k/js Browser app and it's building without an error.
That Compose Web template seems to have an issue, because I haven't done anything after it's creation.
o

Oleksandr Karpovich [JB]

02/03/2023, 2:08 PM
just try it again, create from a compose template. those modules are not related to compose and compose doesn’t do anything to sync up node_modules
с

Стефан Јовановић

02/03/2023, 2:12 PM
The same error
This is the template that I've used
o

Oleksandr Karpovich [JB]

02/03/2023, 2:14 PM
one more thing to try: the template by default uses an old version. in gradle properties you can update koltin to 1.8.0 and compose to 1.3.0 then it may require running ./gradlew kotlinUpgradeYarnLock
Does you k/js sample buid folder have that upath.js file?
с

Стефан Јовановић

02/03/2023, 2:19 PM
I've updated kotlin and compose versions, but when I run that command afterwards I get an error
Can you print me your JAVA_HOME variable value
To compare
the version
o

Oleksandr Karpovich [JB]

02/03/2023, 2:23 PM
it’s java 15 and I checked it on MacOs. I’ll try to check on windows later
с

Стефан Јовановић

02/03/2023, 2:30 PM
I'm using 1.8.0, I was able to execute that command with success, but still same error when running jsBrowserRun from gradle
I think it has something to do with the Java version..will have to experiment a bit.. Thank you for your answers Oleksandr, I really appreciate it! 🙌
27 Views