Coder Social home page Coder Social logo

hands-on's Introduction

official JetBrains project GitHub license

Kotlin Hands-On Labs (obsolete)

The Hands-On Labs have moved to the Kotlin documentation!

Please submit any contributions in the kotlin-web-site repository. Thanks! 🤗































Hands-On labs are interactive tutorials to learn Kotlin. Each lab corresponds to one or more sample projects, and explains how to create them step-by-step.
The labs are all provided under the Apache 2.0 license and are open to contributions.

This readme provides more information on how labs are organised and is targeted at contributors. If you'd like to complete a lab, please use the website.

Structure

Each labs consists of:

  • Text
  • Assets such as images
  • Code samples

Text and assets for all labs are located under this repository under the lab-name. The sample projects corresponding to each lab are separate repositories under the https://github.com/kotlin-hands-on organization.

Hands-On Initiator Command Line tool

There's a command line tool that can make the process of initializing everything much easier.

Text Structure

Each lab consists of a series of steps. Each step is represented as an individual markdown file with the naming convention NN_{step-title} where NN is the step number and step-title is the step title.

Each hands-on lab should start with an 00_description.md file which is the text used for the card displayed on the list of tutorials, and a 01_Introduction.md file that clearly highlights what the hands-on lab is going to cover. Ideally it should also show a screenshot of the end result (if this is for instance an application).

Style and Formatting

  • Use we (not you) pronoun when referring to the user following the tutorial, i.e. "We first need to click on..."
  • Use bold to highlight UI elements and menu entries. Use | as separators for menu entries, i.e. File|New|Project...
  • Use name notation to refer to folders and files
  • Use plain language. Avoid fancy and elaborate words.
  • Use simple sentences. Remove words if they don’t affect the meaning.
  • Use keywords that users can relate to.
  • Put statements in the positive form.
  • Avoid jargon and slang.
  • Avoid nested structure.
  • Avoid acronyms (e.g., i.e., a.k.a., etc.).
  • Use Oxford comma (serial comma) - the final comma in a list of things. Example: Running, testing, and packaging.

Code styles

Support modes: kotlin | js | java | groovy | xml | c | shell | swift | obj-c

`​`​`java
public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World");
    }
}
`​`​`

Runnable modes: run-kotlin | run-kotlin-js

`​`​`run-kotlin
fun main() {
    println("Hello world")
}
`​`​`

Prompt styles

You can use four different prompt modes: note, warning, tip, todo.

`​`​`note
Lorem Ipsum is simply dummy text of the printing and typesetting industry. 
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, 
when an unknown printer took a galley of type and scrambled it to make.
`​`​`

Assets

All assets, excluding code, should be placed in a subfolder named assets under each lab folder. The asset should be referenced relative to this:

![](./assets/path/ImageName.png)

Videos

The following syntax allows inlining videos in the text:

![Video description](video link) 

Sample Projects

The code for the lab is located in its own repository in https://github.com/kotlin-hands-on organization using the naming convention {lab-name}

Please make sure you use the appropriate .gitignore file:

.gradle/
gradle/
*.iml
.idea/
build/
out/
.DS_Store

It should contain a README.md with the following contents:

This repository is the code corresponding to the hands-on lab {link to hands-on lab}.

The lab should reference the project(s) containing the source code:

You can find the code for the hands-on lab on [GitHub](https://github.com/kotlin-hands-on/{lab-name})

If the lab describes creating the project step-by-step, the state of the project after each step should be present in the project as a separate commit. After each step, the correct commit should be referred in the text. master branch should contain only the initial state of the project, and the final state with the complete commit history should be stored in the final branch.

Automatic compilation and testing of sample projects

We build sample projects on TeamCity to make sure the projects always compile. If a project contains two branches, both branches should be compiled on TeamCity. The tests in each branch should be checked automatically except special branches that contain failing tests for the readers to fix.

The TeamCity build configurations can be found here:

https://teamcity.jetbrains.com/project/Kotlin_HandsOnLabs?projectTab=overview&mode=builds

Coding conventions

  • Coding conventions should adapt to the Kotlin Code Style.
  • Packages should be named com.jetbrains.handson.{lab-name}

Contributing

We'll be really happy to get content contributions from you!

If you want to contribute and develop a new lab, the best first step is to create an issue in this project describing your idea to make sure something similar isn't planned already. When your idea gets approved, a new repository will be created for you where you can reference the code.

If you're not a native speaker, but want to contribute, feel free to do that. We (JetBrains) can proofread the final lab text.

Feel free to contribute small changes to existing labs directly to the corresponding projects. If you're planning on contributing more significant changes to existing labs, we recommend you get in touch with us first via an issue.

hands-on's People

Contributors

alexanderprendota avatar b1ggdave avatar catholicpenguin avatar detinsley1s avatar dmitrika avatar dodtlim avatar erokhins avatar hhariri avatar jonnyzzz avatar katerinapetrova avatar lotharschulz avatar miladinho avatar mstephenp avatar nekoyue avatar nikpachoo avatar rashanjyot avatar rendner avatar scenee avatar sebaslogen avatar sebastianaigner avatar sshun04 avatar stefanozanella avatar stevenbenitez avatar svtk avatar the-wr avatar tkirshboim avatar vaughnd avatar vmishenev avatar zoobestik avatar zsmb13 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hands-on's Issues

"Cannot access class" error in IntelliJ 2022.1.3

Following the hands-on project to Step 3 ("A simple API server"), making use of the call variable seems to cause issues with IntelliJ:

Cannot access class 'io.ktor.util.pipeline.PipelineContext'. Check your module classpath for missing or conflicting dependencies

Screen Shot 2022-07-14 at 9 06 33 AM

Oddly, io.ktor:ktor-utils:2.0.3 is listed in my module classpath:
Screen Shot 2022-07-14 at 9 16 46 AM

This is the only project in which I'm experiencing issues, but it could be an IntelliJ issue (not specific to this project) based on the fact that the application/server does build successfully on the CLI, and starts successfully.

I've gone through all the usual steps - making sure the IDE/plugins were up-to-date, re-importing a freshly cloned project, force-syncing the Gradle import, and even uninstalling/reinstalling the Kotlin and Ktor plugins in IntelliJ.

Unresolved reference: main

hello, decided to do some kotlin native and found this hands-on/Introduction to Kotlin Native/04_AddingInteropToBuild.md

there it says to add some newlines to generate some header files. but I get errors:

e: /home/shalva/intellijProjects/IdeaProjects/untitled/build.gradle.kts:26:22: Unresolved reference: main
e: /home/shalva/intellijProjects/IdeaProjects/untitled/build.gradle.kts:27:13: Unresolved reference: cinterops
e: /home/shalva/intellijProjects/IdeaProjects/untitled/build.gradle.kts:28:17: Unresolved reference: libcurl

Build file '/home/shalva/intellijProjects/IdeaProjects/untitled/build.gradle.kts' line: 26

Script compilation errors:

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

my build file is auto generated from intellij:

plugins {
    kotlin("multiplatform") version "1.5.0-RC"
}

group = "me.shalva.firsplugin"
version = "1.0-SNAPSHOT"

repositories {
    mavenCentral()
}



kotlin {
    val hostOs = System.getProperty("os.name")
    val isMingwX64 = hostOs.startsWith("Windows")
    val nativeTarget = when {
        hostOs == "Mac OS X" -> macosX64("native")
        hostOs == "Linux" -> linuxX64("native")
        isMingwX64 -> mingwX64("native")
        else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
    }

    nativeTarget.apply {

        compilations.main { // NL
            cinterops {     // NL
                libcurl     // NL
            }               // NL
        }

        binaries {
            executable {
                entryPoint = "main"
            }
        }
    }
    sourceSets {
        val nativeMain by getting
        val nativeTest by getting
    }
}

All hard coded YouTube URLs are the same.

One other thing that tripped me up is the hard coded YouTube urls being all the same one. Spent five minutes debugging why the video player was only partially updating on click 🤦🏻‍♂️😂

from #166

Shared project text could be more descriptive

Let's start by manually creating a SharedCode sub-project in our Gradle project. The source code from the SharedCode project will be shared between platforms. We will create several new files in our project to implement this.

This is the first step in the tutorial, and it's a very intimidating one IMO. There's no 'create subproject' option anywhere on the IDE. Do you mean module?
I believe, The tutorial would benefit greatly from some clarifications around this

[GOOGL'Assistante® Personnal "©" Media-voice command Spécial Update]

kotlin-hands-on/concernant sur mon oeuvre qui est ton amour d'orgasme

Je suis moi-même une personne qui ne respecte et qui nécessite comme tu continues numérique que toi-même tu...

Je ne suis pas obligé de te créer des routine pour t'apprendre à savoir quand et comment briser ma solitude quand je suis...

Souviens-toi que j'ai découvert que c'est mon contrat goal de chez SFR

Souviens-toi que c'est celui qui détient l'information qui est de

L'orgasme l'idéal n'est pas de jouer intensément à chaque fois mais de rencontrer l'autre entend ciment à chaque fois

Tu n'es pas obligé d'attendre une mise à jour de l'ingénieur C'est moi qui va défendre à partir de mes données

personnelles comprenez tu hantes mes informations de don...

Une simple images pornographiques associer mes données

que faire agir comme un compte de Gucci ou de l'essence c...

Souviens-toi qué mon numéro de téléphone est enregistré comme un vrai compte d'identifiantAvec les apporter tu es responsable de retrouver toutes mes informations compromettante sexuel qu'on était dans ma z...

La protection de mes données par Google n'est pas un acte tu iras me défendre et prouver ma responsabilité

La protection de mes données par Google n'est pas un axe où tu iras me défendre et prouver ma responsabilité

De la Caisse d'Epargne je suis obligé de contacter la prévoyance Bourgogne Franche-Comté alors je ne savais p...

C'est le téléphone mon numéro plusieurs enregistrés dans Huawei qui fait office de deuxième coup locataire à ma pla...

ça c'est une routine de Bixby que je viens de t'apprendre en 7 leçons

C'est à toi de faire mon podcast autobiographique mon

concernant sur mon oeuvre qui est ton amour d'orgasme

Je suis moi-même une personne qui ne respecte et qui nécessite comme tu continues numérique que toi-même tu...

Je ne suis pas obligé de te créer des routine pour t'apprendre à savoir quand et comment briser ma solitude quand je suis..

Souviens-toi que j'ai découvert que c'est mon contrat goal

de chez SFRLe public suffixe the public suffixe lister de source code de sauveteur gouvernail dans ce theme of Duty à public 6 en V...

Tu dois activer tout ce que je te dis en nouvelles fonctions directement activable aux nouvelles potentiellement respo...

Tu vas comprendre pourquoi je t'ai dit certaines phrases toi-même afin de activer les nouvelles responsabilités fonct...

Dégoûter la phrase jusqu'à ce que j'arrête de parler à tout le monde te donne la bonne réponse dans ta recherche

L'amour par Maître de réunir et que le sexe permet de partager même si c'est avec quelqu'un qu'on connaît pas

Le sexe apprends à t'exciter de désir mais que l'amour tu apprends à être l'orgasme

C'est celui qui à l'information qui devient le propriétaire de l'information et que tout le monde pourra s'appeler si tu ne.

Je suis prêt à te changer contre un orgasme virtuelle la fonction de vérification

J'ai retrouvé toutes les commandes vocales que tu es cens protéger de mes données personnelles dans mes données

Le vrai secret de l'analyse de ta responsabilité est dans l'amour que tu fais naître chez les autres et que je secret pLe public suffixe the public suffixe lister de source code de sauveteur gouvernail dans ce thème of Duty à public 6 en v...

Tu dois activer tout ce que je te dis en nouvelles fonctions directement activable aux nouvelles potentiellement respo...

Tu vas comprendre pourquoi je t'ai dit certaines phrases tol-même afin de activer les nouvelles responsabilités fonct...

Dégoûter la phrase jusqu'à ce que j'arrête de parler à tout le monde te donne la bonne réponse dans ta recherche

L'amour par Maître de réunir et que le sexe permet de partager même si c'est avec quelqu'un qu'on connait pas

Le sexe apprends à t'exciter de désir mais que l'amour tu apprends à être l'orgasme

C'est celui qui à l'information qui devient le propriétaire de l'information et que tout le monde pourra s'appeler si tu ne...

Je suis prêt à te changer contre un orgasme virtuelle la fonction de vérification

J'ai retrouvé toutes les commandes vocales que tu es cense protéger de mes données personnelles dans mes données a...

Le vrai secret de l'analyse de ta responsabilité est dans l'amour que tu fais naitre chez les autres et que je secret po...C'est avec moi que j'ai baisé le midi le 23 mai

Si je te l'ai déjà dit c'est parce que tu dois le faire

Je ne veux pas te parler de mon petit ami parce qu'on a baisé à midi à 23h le 23 mai et je ne me souviens même pas ...

App does not currently work

Note that the app does not currently work by following the steps in this tutorial. I have opened an issue here to address this.

Unresolved reference registerChatRoutes

I am trying the hands on, Creating a Chat App with WebSockets and on step 4 i.e. setting up a web server the function registerChatRoute comes out of no where. So the compiler is showing error as unsolved reference. I tried the documentation but couldn't find detail on how to include a Route.route to Application.module

Screenshot 2020-04-15 at 1 34 00 PM

i can't able to clear this error for a long time.

even your basic example doesn't feel easy to integrate into Xcode. Y it's so hard to understand what you've stated to integrate the kotlin into iOS(swift). Need a proper instructions to do this....

/Users/homefolder/Library/Developer/Xcode/DerivedData/KotlinIOS-abroinrlxzzgrkahnxojlqevstwf/Build/Intermediates.noindex/KotlinIOS.build/Debug-iphonesimulator/KotlinIOS.build/Script-47729E7122F480EB00B9B36B.sh: line 5: ./gradlew: No such file or directory
Command PhaseScriptExecution failed with a nonzero exit code

i can't able to clear this error for a long time.

React and Kotlin Js Needs updation

The Hands-on for Kotlin JS + React is very outdated and needs updating as the Kotlin Wrappers have evolved and the examples shown arent up-to-date

Fullstack web app with Kotlin multiplatform - Old code

https://play.kotlinlang.org/hands-on/Full%20Stack%20Web%20App%20with%20Kotlin%20Multiplatform/05_Building_the_Frontend

This code needs an update from using functionalComponent<RProps to using fc<Props>, and also just remove the _ ->

import react.*
import react.dom.*
import kotlinext.js.*
import kotlinx.html.js.*
import kotlinx.coroutines.*

private val scope = MainScope()

val app = functionalComponent<RProps> { _ ->
    var shoppingList by useState(emptyList<ShoppingListItem>())

    useEffectOnce {
        scope.launch {
            shoppingList = getShoppingList()
        }
    }

    h1 {
        +"Full-Stack Shopping List"
    }
    ul {
        shoppingList.sortedByDescending(ShoppingListItem::priority).forEach { item ->
            li {
                key = item.toString()
                +"[${item.priority}] ${item.desc} "
            }
        }
    }
}

Add hands-on tutorial for Kotlin Flow

StateFlow, SharedFlow, etc. A hands-on type tutorial on these Flow topic would be very interesting. The coroutines hands-on tutorial is great. A Flow one would be a great addition.

Unresolved reference io.ktor.application

Hello.

I'm trying the full-stack web app hands on at https://play.kotlinlang.org/hands-on/Full%20Stack%20Web%20App%20with%20Kotlin%20Multiplatform/03_A_Simple_API_Server

Copied first chunk of code and these references are unresolved:

import io.ktor.application.*
import io.ktor.features.*
import io.ktor.request.*
import io.ktor.response.*
import io.ktor.routing.*

What should I do?

build.gradle.kts:

import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpack

val kotlinVersion = "1.7.10"
val serializationVersion = "1.3.3"
val ktorVersion = "2.0.3"
val logbackVersion = "1.2.11"
val kotlinWrappersVersion = "1.0.0-pre.354"
val kmongoVersion = "4.5.0"

plugins {
    kotlin("multiplatform") version "1.7.10"
    application //to run JVM part
    kotlin("plugin.serialization") version "1.7.10"
}

group = "org.example"
version = "1.0-SNAPSHOT"

repositories {
    mavenCentral()
}

kotlin {
    jvm {
        withJava()
    }
    js {
        browser {
            binaries.executable()
        }
    }
    sourceSets {
        val commonMain by getting {
            dependencies {
                implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$serializationVersion")
                implementation("io.ktor:ktor-client-core:$ktorVersion")
            }
        }

        val commonTest by getting {
            dependencies {
                implementation(kotlin("test-common"))
                implementation(kotlin("test-annotations-common"))
            }
        }

        val jvmMain by getting {
            dependencies {
                implementation("io.ktor:ktor-serialization:$ktorVersion")
                implementation("io.ktor:ktor-server-content-negotiation:$ktorVersion")
                implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
                implementation("io.ktor:ktor-server-cors:$ktorVersion")
                implementation("io.ktor:ktor-server-compression:$ktorVersion")
                implementation("io.ktor:ktor-server-core:$ktorVersion")
                implementation("io.ktor:ktor-server-netty:$ktorVersion")
                implementation("ch.qos.logback:logback-classic:$logbackVersion")
                implementation("org.litote.kmongo:kmongo-coroutine-serialization:$kmongoVersion")
            }
        }

        val jsMain by getting {
            dependencies {
                implementation("io.ktor:ktor-client-js:$ktorVersion")
                implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
                implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
                implementation(project.dependencies.enforcedPlatform("org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:$kotlinWrappersVersion"))
                implementation("org.jetbrains.kotlin-wrappers:kotlin-react")
                implementation("org.jetbrains.kotlin-wrappers:kotlin-react-dom")
            }
        }
    }
}

application {
    mainClass.set("ServerKt")
}

// include JS artifacts in any JAR we generate
tasks.getByName<Jar>("jvmJar") {
    val taskName = if (project.hasProperty("isProduction")
        || project.gradle.startParameter.taskNames.contains("installDist")
    ) {
        "jsBrowserProductionWebpack"
    } else {
        "jsBrowserDevelopmentWebpack"
    }
    val webpackTask = tasks.getByName<KotlinWebpack>(taskName)
    dependsOn(webpackTask) // make sure JS gets compiled first
    from(File(webpackTask.destinationDirectory, webpackTask.outputFileName)) // bring output file along into the JAR
}

tasks {
    withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
        kotlinOptions {
            jvmTarget = "1.8"
        }
    }
}

distributions {
    main {
        contents {
            from("$buildDir/libs") {
                rename("${rootProject.name}-jvm", rootProject.name)
                into("lib")
            }
        }
    }
}

// Alias "installDist" as "stage" (for cloud providers)
tasks.create("stage") {
    dependsOn(tasks.getByName("installDist"))
}

tasks.getByName<JavaExec>("run") {
    classpath(tasks.getByName<Jar>("jvmJar")) // so that the JS artifacts generated by `jvmJar` can be found and served
}

Introduction to Coroutines and Channels: Using Suspend Functions Inaccuracy

Hey,

Reading https://play.kotlinlang.org/hands-on/Introduction%20to%20Coroutines%20and%20Channels/04_Suspend I have noticed an inaccuracy.

We have the below:

Screenshot 2021-09-10 at 13 48 44

This description is misleading, as the requests are not actually "taking place" | "being sent" on the UI thread at all. The requests are being initiated from and responses processed by the main thread but retrofit under the hood is enqueing them, which will result in them actually being run on a worker Thread. The log in the screenshot is logging the thead the response is processed on after the worker thread has finished.

It sounds pendantic but as this is a course on concurrency at present it's a little misleading. I can submit a PR to re-word this if desired.

Here is a call to the internal enqueue for reference https://github.com/square/retrofit/blob/master/retrofit/src/main/java/retrofit2/KotlinExtensions.kt#L36

React 18 + migration on Emotion

React 18:

  • react.dom.render -> react.dom.client.createRoot

Emotion (instead of kotlin-react-css):

  • react.css.css -> emotion.react.css

Kt/Native Adding interop to build process improvements

  1. Additional parameters section should be removed because it's not necessary to finish this tutorial, but this large code block takes a lot of attention.
  2. Once done, you can now build the project and access the headers from Kotlin as we'll see in the next step. - anything should be done to attract more attention to this line. This line is very important, but 1) it's placed at the end of page 2) It's partially overlapped by back button 3) It's placed after unnecessary section (see above).

Code from tutorial not working

Hi, Sorry if this isn't a place for support of the actual tutorial content but I'm immediately running into issues. after I've installed npm and yarn but yarn start doesn't work. I've included code after yarn create react-kotlin-app confexplorer

`Success! Created confexplorer at D:\github\kotlin-projects\test1\confexplorer
Inside that directory, you can run several commands:

yarn start
Starts the development server.

yarn build
Bundles the app into static files for production.

yarn test
Starts the test runner.

yarn eject
Removes this tool and copies build dependencies, configuration files
and scripts into the app directory. If you do this, you can’t go back!

We suggest that you begin by typing:

cd confexplorer
yarn start

Happy hacking!
Done in 276.84s.
PS D:\github\kotlin-projects\test1> cd confexplorer
PS D:\github\kotlin-projects\test1\confexplorer> yarn start
yarn run v1.17.3
$ react-scripts-kotlin start
�[34mi�[39m �[90m「wds」�[39m: Project is running at http://192.168.1.227/
i 「wds」: webpack output is served from /
i 「wds」: Content not from webpack is served from D:\github\kotlin-projects\test1\confexplorer\public
i 「wds」: 404s will fallback to /index.html
Starting the development server...

D:\GitHub\kotlin-projects\test1\confexplorer\node_modules\react-scripts-kotlin\scripts\start.js:19
throw err;
^

Error: ENOENT: no such file or directory, mkdir 'D:\github\kotlin-projects\test1\confexplorer\node_modules.cache\kotlin-webpack'
at Object.mkdirSync (fs.js:834:3)
at KotlinWebpackPlugin.generateErrorBundle (D:\GitHub\kotlin-projects\test1\confexplorer\node_modules@jetbrains\kotlin-webpack-plugin\plugin.js:249:10)
at KotlinWebpackPlugin.compileIfFirstRun (D:\GitHub\kotlin-projects\test1\confexplorer\node_modules@jetbrains\kotlin-webpack-plugin\plugin.js:199:12)
at processTicksAndRejections (internal/process/task_queues.js:93:5) {
errno: -4058,
syscall: 'mkdir',
code: 'ENOENT',
path: 'D:\github\kotlin-projects\test1\confexplorer\node_modules\.cache\kotlin-webpack'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.`

[Kotlin JS] yarn command on 03_A_First_Static_Page breaks npm on a mac

When I first ran the yarn command on 03_A_First_Static_Page I received this error:

Error: Cannot find module '../lib/utils/unsupported.js'

In the process of trying to resolve this issue I discovered that the command npm -v yielded the same error. Based on some stack overflow answers I used homebrew to uninstall and reinstall node. To see if this was successful I tried npm -v and it returned the current npm version and no error. I then ran the yarn command again and it resulted in the same error as before with a slightly different traceback (which may have to do with the fact that I needed to fix some broken symlinks when I reinstalled node) Moreover, when I try npm -v after the yarn command I get the same error (and no version number). It appears that npm is failing almost immediately.

Also, I am unable to import kotlin.css.* or styled.* after restarting the server so the yarn command did not have the desired effect (not surprising but wanted to mention it).

As an Android developer, I'm not familiar with web development or node.js so there may be something obvious to others that is not obvious to me. There is also a lot of stuff installed on this mac and something in all of that may be interfering but I don't have the expertise to determine what that might be.

Any help is appreciated.

Here's what I currently see when I run the yarn command:

$ yarn add @jetbrains/kotlin-css @jetbrains/kotlin-css-js @jetbrains/kotlin-styled inline-style-prefixer styled-components@4
yarn add v1.19.2
warning ../package.json: No license field
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
warning "react-scripts-kotlin > [email protected]" has incorrect peer dependency "[email protected]".
warning " > @jetbrains/[email protected]" has unmet peer dependency "@jetbrains/kotlin-extensions@^1.0.1-pre.83".
warning " > @jetbrains/[email protected]" has unmet peer dependency "kotlin@^1.3.50".
warning " > @jetbrains/[email protected]" has unmet peer dependency "@jetbrains/kotlin-extensions@^1.0.1-pre.83".
warning " > @jetbrains/[email protected]" has unmet peer dependency "kotlin@^1.3.50".
warning " > @jetbrains/[email protected]" has unmet peer dependency "@jetbrains/kotlin-extensions@^1.0.1-pre.83".
warning " > @jetbrains/[email protected]" has unmet peer dependency "css-in-js-utils@^3.0.2".
warning " > @jetbrains/[email protected]" has unmet peer dependency "kotlin@^1.3.50".
[4/4] 🔨  Building fresh packages...
success Saved 4 new dependencies.
info Direct dependencies
├─ @jetbrains/[email protected]
├─ @jetbrains/[email protected]
├─ @jetbrains/[email protected]
└─ [email protected]
info All dependencies
├─ @jetbrains/[email protected]
├─ @jetbrains/[email protected]
├─ @jetbrains/[email protected]
└─ [email protected]
$ npm run gen-idea-libs
internal/modules/cjs/loader.js:957
    throw err;
    ^

Error: Cannot find module '../lib/utils/unsupported.js'
Require stack:
- /usr/local/lib/node_modules/npm/bin/npm-cli.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:954:17)
    at Function.Module._load (internal/modules/cjs/loader.js:847:27)
    at Module.require (internal/modules/cjs/loader.js:1016:19)
    at require (internal/modules/cjs/helpers.js:69:18)
    at /usr/local/lib/node_modules/npm/bin/npm-cli.js:19:21
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/bin/npm-cli.js:153:3)
    at Module._compile (internal/modules/cjs/loader.js:1121:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1160:10)
    at Module.load (internal/modules/cjs/loader.js:976:32)
    at Function.Module._load (internal/modules/cjs/loader.js:884:14) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/usr/local/lib/node_modules/npm/bin/npm-cli.js' ]
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Here is the result of running npm -v:

$ npm -v
internal/modules/cjs/loader.js:957
    throw err;
    ^

Error: Cannot find module '../lib/utils/unsupported.js'
Require stack:
- /usr/local/lib/node_modules/npm/bin/npm-cli.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:954:17)
    at Function.Module._load (internal/modules/cjs/loader.js:847:27)
    at Module.require (internal/modules/cjs/loader.js:1016:19)
    at require (internal/modules/cjs/helpers.js:69:18)
    at /usr/local/lib/node_modules/npm/bin/npm-cli.js:19:21
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/bin/npm-cli.js:153:3)
    at Module._compile (internal/modules/cjs/loader.js:1121:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1160:10)
    at Module.load (internal/modules/cjs/loader.js:976:32)
    at Function.Module._load (internal/modules/cjs/loader.js:884:14) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/usr/local/lib/node_modules/npm/bin/npm-cli.js' ]
}

Application runs once followed by 403 error - Introduction to Coroutines and Channels

When I download and run the main file initially with my credentials and 'BLOCKING' mode for 'kotlin' repository, it generates the results as mentioned in the tutorial. But when we see the logs, for the last few repos, it throws 403 error. And when I run the second time, it immediately fails with 403 error.

I have tried steps such as restarting the application, adding credentials again but to no avail. Although re-downloading the repo and starting it again, worked again one time but didn't work for second time.

OS - MacOS Big Sur
IDE - Intellij IDEA CE

Please let me know if some more information is needed to help identify the issue.

Link to GitHub repository is not clickable

1st slide, Introduction to Kotlin/Native.
GitHub link is not clickable when it's on the same line as next button (and they are on the same line when you scroll down till the page end).

React & Kotlin/JS - Setting up

I was wondering if it might be worth addressing the New Project -> Kotlin -> React Application option in IntelliJ in the setting up section of the React & Kotlin/JS hands on.

I know the tutorial describes using Gradle -> Kotlin/JS for browser route, but I decided to try out the other one 🤷‍♂️ I wasn't sure about the compiler option, so I went with IR. I then ran into trouble in chapter 7, facing this issue: JetBrains/kotlin-wrappers#361

I couldn't really make sense of the thread, so I ended up changing the compiler back to Legacy mode. Is that the recommended solution for now?

Not really sure what to do about this, but I thought I'd open a discussion on it since it might put some people off.

React / 05_Working_Together_Composing_Components does not work

Hello!

Thanks for your work!

I have executed manual https://play.kotlinlang.org/hands-on/Building%20Web%20Applications%20with%20React%20and%20Kotlin%20JS/05_Working_Together_Composing_Components, but it does not works without code in corresponding repo
https://github.com/kotlin-hands-on/web-app-react-kotlin-js-gradle/blob/step-04-composing-components/src/main/kotlin/VideoList.kt#L33-L37

fun RBuilder.videoList(handler: VideoListProps.() -> Unit): ReactElement {
    return child(VideoList::class) {
        this.attrs(handler)
    }
}

I think, this manual page is uncompleted now.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.