varabyte / kobweb

A modern framework for full stack web apps in Kotlin, built upon Compose HTML
https://kobweb.varabyte.com
Apache License 2.0
1.46k stars 65 forks source link

Investigate issues with M1 on Mac #140

Closed bitspittle closed 1 year ago

bitspittle commented 2 years ago

I've heard one report that Mac + M1 fails with an error like so:

> Configure project :
Kotlin Multiplatform Projects are an Alpha feature. See: https://kotlinlang.org/docs/reference/evolution/components-stability.html. To hide this message, add 'kotlin.mpp.stability.nowarn=true' to the Gradle properties.

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':kotlinNodeJsSetup'.
> Could not resolve all files for configuration ':detachedConfiguration1'.
   > Could not find org.nodejs:node:14.17.0.
     Searched in the following locations:
       - https://repo.maven.apache.org/maven2/org/nodejs/node/14.17.0/node-14.17.0.pom
       - https://maven.pkg.jetbrains.space/public/p/compose/dev/org/nodejs/node/14.17.0/node-14.17.0.pom
       - https://dl.google.com/dl/android/maven2/org/nodejs/node/14.17.0/node-14.17.0.pom
       - https://us-central1-maven.pkg.dev/varabyte-repos/public/org/nodejs/node/14.17.0/node-14.17.0.pom
       - https://nodejs.org/dist/v14.17.0/node-v14.17.0-darwin-arm64.tar.gz
     Required by:
         project :

* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Exception is:
org.gradle.api.internal.tasks.TaskDependencyResolveException: Could not determine the dependencies of task ':kotlinNodeJsSetup'.
    at org.gradle.api.internal.tasks.CachingTaskDependencyResolveContext.getDependencies(CachingTaskDependencyResolveContext.java:71)
    at org.gradle.execution.plan.TaskDependencyResolver.resolveDependenciesFor(TaskDependencyResolver.java:49)
    at org.gradle.execution.plan.LocalTaskNode.getDependencies(LocalTaskNode.java:168)
    at org.gradle.execution.plan.LocalTaskNode.resolveDependencies(LocalTaskNode.java:133)
    at org.gradle.execution.plan.DefaultExecutionPlan.doAddNodes(DefaultExecutionPlan.java:202)
...

Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':detachedConfiguration1'.
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.rethrowFailure(DefaultConfiguration.java:1503)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.access$3700(DefaultConfiguration.java:159)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$DefaultResolutionHost.rethrowFailure(DefaultConfiguration.java:2139)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.visitContents(DefaultConfiguration.java:1475)
...

Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find org.nodejs:node:14.17.0.
Searched in the following locations:
  - https://repo.maven.apache.org/maven2/org/nodejs/node/14.17.0/node-14.17.0.pom
  - https://maven.pkg.jetbrains.space/public/p/compose/dev/org/nodejs/node/14.17.0/node-14.17.0.pom
  - https://dl.google.com/dl/android/maven2/org/nodejs/node/14.17.0/node-14.17.0.pom
  - https://us-central1-maven.pkg.dev/varabyte-repos/public/org/nodejs/node/14.17.0/node-14.17.0.pom
  - https://nodejs.org/dist/v14.17.0/node-v14.17.0-darwin-arm64.tar.gz
Required by:
    project :

* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

BUILD FAILED in 42s
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.4/userguide/command_line_interface.html#sec:command_line_warnings

Exiting continuous build as no executed tasks declared file system inputs.

Starting a Kobweb server (development).

Full pastebin attached: Kobweb startup failure.txt

bitspittle commented 2 years ago

Seems like this will get fixed (probably) when I can upgrade Kotlin to 1.6.20

A workaround for now is to add the following to your app's build.gradle.kts file:

rootProject.plugins.withType<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin> {
    rootProject.the<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension>().nodeVersion = "16.0.0"
}

See also: https://youtrack.jetbrains.com/issue/KT-49109

stalexxx commented 1 year ago

Old version of compose compiler corresponds to old NodeJs with is not available for arm64

bitspittle commented 1 year ago

Old version of compose compiler corresponds to old NodeJs with is not available for arm64

Yeah it's not great. I'm still waiting on web compose to update so we can use newer versions. Did you try the workaround in https://github.com/varabyte/kobweb/issues/140#issuecomment-1073294231 ?

bitspittle commented 1 year ago

Note that Kobweb is now updated so latest (0.10.0+) targets later versions of Kotlin and Compose.

I'm going to mark this as closed, because it should have been fixed long ago; however, if anyone is still seeing this with latest, let me know!