kotlin / full-stack-web-jetbrains-night-sample Goto Github PK
View Code? Open in Web Editor NEWFull-stack demo application written with Kotlin MPP
Full-stack demo application written with Kotlin MPP
Grabbing the project, opening it in IntelliJ and then running "Development Run" results in the error:
[webpack-cli] Unable to load '@webpack-cli/serve' command
[webpack-cli] TypeError: options.forEach is not a function
Stack overflow suggests adding this to the build.gradle.kts as a possible solution:
rootProject.plugins.withType(org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin::class.java) {
rootProject.the<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension>().versions.webpackCli.version = "4.9.0"
}
Which seems to partly help, and the site opens, but it only displays the text "Cannot GET /"
The other solution on that page (kotlin.js.webpack.major.version=4 in gradle.properties) throws up whole pile of different errors and webpack cannot complete at all.
Error while trying to run project by executing ./gradlew :server:run
:
Could not determine the dependencies of task ':kotlinNodeJsSetup'.
> Could not resolve all files for configuration ':detachedConfiguration2'.
> 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/kotlinx-html/maven/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 :
Could not find node-v14.17.0-darwin-arm64.tar.gz at node v14.17.0,
But support of darwin-arm64
can be found at other node versions like v16.17.0.
So, How can I change the dependency version of node?
The following looks suspicious
What is the purpose of the code?
Should it be written as
run {
dependsOn ":server:prepareDevServer"
}
?
Hi
When I run the sample project from Intellij "Development Run" I get
BUILD SUCCESSFUL in 2m 8s
12 actionable tasks: 10 executed, 2 up-to-date
Waiting for changes to input files of tasks... (ctrl-d then enter to exit)
<i> [webpack-dev-server] [HPM] Proxy created: / -> http://localhost:8080
<i> [webpack-dev-server] Project is running at:
<i> [webpack-dev-server] Loopback: http://localhost:8080/
<i> [webpack-dev-server] On Your Network (IPv4): http://192.168.0.20:8080/
<i> [webpack-dev-server] Content not from webpack is served from 'C:\Projects\full-stack-web-jetbrains-night-sample\client\build\processedResources\js\main' directory
<i> [webpack-dev-middleware] wait until bundle finished: /
<e> [webpack-dev-server] [HPM] Error occurred while proxying request localhost:8080/ to http://localhost:8080/ [ENOBUFS] (https://nodejs.org/api/errors.html#errors_common_system_errors)
If I run the same project from the terminal: ./gradlew :client:run -t
> Configure project :client
Project property 'kotlin.parallel.tasks.in.project' is deprecated.
By default it depends on Gradle parallel project execution option value.
> Configure project :shared
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.
> Task :kotlinNpmInstall
warning workspace-aggregator-5416cb96-b9ab-4461-8193-238c285a81fe > kotlin-full-stack-application-demo-client > webpack-dev-server > url > [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API i
nstead.
warning workspace-aggregator-5416cb96-b9ab-4461-8193-238c285a81fe > kotlin-full-stack-application-demo-client > webpack-dev-server > sockjs > [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain ci
rcumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
warning "workspace-aggregator-5416cb96-b9ab-4461-8193-238c285a81fe > kotlin-full-stack-application-demo-client > @jetbrains/[email protected]" has incorrect peer dependency "core-js@>=3.0.0".
warning "workspace-aggregator-5416cb96-b9ab-4461-8193-238c285a81fe > kotlin-full-stack-application-demo-client > @jetbrains/[email protected]" has unmet peer dependency "react@>=16.8.0".
warning "workspace-aggregator-5416cb96-b9ab-4461-8193-238c285a81fe > kotlin-full-stack-application-demo-client > @jetbrains/[email protected]" has unmet peer dependency "react-dom@>=16.8.0".
warning "workspace-aggregator-5416cb96-b9ab-4461-8193-238c285a81fe > kotlin-full-stack-application-demo-client > @jetbrains/ring-ui > [email protected]" has unmet peer dependency "eslint@^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0
.0".
warning "workspace-aggregator-5416cb96-b9ab-4461-8193-238c285a81fe > kotlin-full-stack-application-demo-client > @jetbrains/ring-ui > [email protected]" has incorrect peer dependency "webpack@^4.0.0".
warning "workspace-aggregator-5416cb96-b9ab-4461-8193-238c285a81fe > kotlin-full-stack-application-demo-client > @jetbrains/ring-ui > [email protected]" has unmet peer dependency "@types/react@>=16".
warning "workspace-aggregator-5416cb96-b9ab-4461-8193-238c285a81fe > kotlin-full-stack-application-demo-client > @jetbrains/ring-ui > [email protected]" has unmet peer dependency "react@>=16".
warning "workspace-aggregator-5416cb96-b9ab-4461-8193-238c285a81fe > kotlin-full-stack-application-demo-client > @jetbrains/ring-ui > [email protected]" has unmet peer dependency "react@^16.3.0-0 || ^17.0.0-0".
warning "workspace-aggregator-5416cb96-b9ab-4461-8193-238c285a81fe > kotlin-full-stack-application-demo-client > @jetbrains/ring-ui > [email protected]" has unmet peer dependency "react-dom@^16.3.0-0 || ^17.0.0-0".
warning "workspace-aggregator-5416cb96-b9ab-4461-8193-238c285a81fe > kotlin-full-stack-application-demo-client > @jetbrains/ring-ui > [email protected]" has unmet peer dependency "react@^15.3.0 || ^16.0.0-alpha".
warning "workspace-aggregator-5416cb96-b9ab-4461-8193-238c285a81fe > kotlin-full-stack-application-demo-client > @jetbrains/ring-ui > [email protected]" has unmet peer dependency "react-dom@^15.3.0 || ^16.0.0-alpha".
warning "workspace-aggregator-5416cb96-b9ab-4461-8193-238c285a81fe > kotlin-full-stack-application-demo-client > @jetbrains/ring-ui > [email protected]" has unmet peer dependency "react@^15.3.0 || ^16.0.0 || ^17.0.0".
warning "workspace-aggregator-5416cb96-b9ab-4461-8193-238c285a81fe > kotlin-full-stack-application-demo-client > @jetbrains/ring-ui > react-markdown > [email protected]" has unmet peer dependency "react@^16.0 || ^17.0".
warning "workspace-aggregator-5416cb96-b9ab-4461-8193-238c285a81fe > kotlin-full-stack-application-demo-client > kotlin-wrappers-kotlin-react-dom-js-ir > [email protected]" has unmet peer dependency "[email protected]".
warning "workspace-aggregator-5416cb96-b9ab-4461-8193-238c285a81fe > kotlin-full-stack-application-demo-client > kotlin-wrappers-kotlin-styled-js-ir > [email protected]" has unmet peer dependency "react@>= 16.8.0".
warning "workspace-aggregator-5416cb96-b9ab-4461-8193-238c285a81fe > kotlin-full-stack-application-demo-client > kotlin-wrappers-kotlin-styled-js-ir > [email protected]" has unmet peer dependency "react-dom@>= 16.8.0".
warning "workspace-aggregator-5416cb96-b9ab-4461-8193-238c285a81fe > kotlin-full-stack-application-demo-client > kotlin-wrappers-kotlin-styled-js-ir > [email protected]" has unmet peer dependency "react-is@>= 16.8.0".
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
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.1.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 14s
12 actionable tasks: 6 executed, 6 up-to-date
Waiting for changes to input files of tasks... (ctrl-d then enter to exit)
<i> [webpack-dev-server] [HPM] Proxy created: / -> http://localhost:8080
<i> [webpack-dev-server] Project is running at:
<i> [webpack-dev-server] Loopback: http://localhost:8080/
<i> [webpack-dev-server] On Your Network (IPv4): http://192.168.0.20:8080/
<i> [webpack-dev-server] Content not from webpack is served from 'C:\Projects\full-stack-web-jetbrains-night-sample\client\build\processedResources\js\main' directory
<i> [webpack-dev-middleware] wait until bundle finished: /
<e> [webpack-dev-server] [HPM] Error occurred while proxying request localhost:8080/ to http://localhost:8080/ [EADDRINUSE] (https://nodejs.org/api/errors.html#errors_common_system_errors)
<-------------> 0% WAITING
> IDLE
> IDLE
And then it gets stuck at 0%
However the production version works: ./gradlew :server:run
The static client resources are loaded from the root package, which gives clients access to the entire backend jar.
For example, run the server and then try to access:
http://localhost:8080/application.conf
or
http://localhost:8080/MainKt.class
Both of these work!
The copy task at https://github.com/Kotlin/full-stack-web-jetbrains-night-sample/blob/master/server/build.gradle.kts#L55-L57 should be modified to put the resources into a subdirectory e.g. web
, and then ktor configured to serve static resources from the web
package only.
server/build.gradle.kts
uses this:
tasks.withType<Copy>().named("processResources") {
from(project(":client").tasks.named("browserDistribution"))
}
This is not only bad practice, it only works by accident, is unsafe and can lead to non-reproducible and hard to parallelize builds.
You can find more information and how to do it properly on https://docs.gradle.org/current/userguide/cross_project_publications.html
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.