Skip to content

cannot run main-kts scripts directly after cloning #35

@ahmedalsaghir0

Description

@ahmedalsaghir0

Straight running main.kts scripts is not working after cloning the repo

Running jvm/main-kts/scripts/kotlin-shell.main.kts directly gives the following compile time errors.

kotlin kotlin-shell.main.kts
kotlin-shell.main.kts:26:13: error: annotation argument must be a compile-time constant.
@file:OptIn(kotlinx.coroutines.ExperimentalCoroutinesApi::class)
            ^
kotlin-shell.main.kts:26:32: error: unresolved reference 'ExperimentalCoroutinesApi'.
@file:OptIn(kotlinx.coroutines.ExperimentalCoroutinesApi::class)
                               ^
kotlin-shell.main.kts:30:44: error: unresolved reference 'shell'.
import eu.jrie.jetbrains.kotlinshell.shell.shell
                                           ^
kotlin-shell.main.kts:32:1: error: unresolved reference 'shell'.
shell {
^
kotlin-shell.main.kts:34:9: error: unresolved reference 'invoke'.
        "echo this is 'ls -l' command for current directory: ${env("PWD")}"()
        ^
kotlin-shell.main.kts:34:64: error: unresolved reference 'env'.
        "echo this is 'ls -l' command for current directory: ${env("PWD")}"()
                                                               ^
kotlin-shell.main.kts:35:9: error: expression 'ls -l' of type 'String' cannot be invoked as a function. Function 'invoke()' is not found.
        "ls -l"()
        ^
kotlin-shell.main.kts:43:9: error: unresolved reference 'pipeline'.
        pipeline {
        ^
kotlin-shell.main.kts:44:30: error: unresolved reference 'process'.
            "cat ${args[0]}".process() pipe
                             ^
kotlin-shell.main.kts:45:21: error: unresolved reference 'streamLambda'.
                    streamLambda { strm, _, _ ->
                    ^
kotlin-shell.main.kts:45:36: error: cannot infer type for value parameter 'strm'. Specify it explicitly.
                    streamLambda { strm, _, _ ->
                                   ^
kotlin-shell.main.kts:45:42: error: cannot infer type for implicit value parameter 'it'. Specify it explicitly.
                    streamLambda { strm, _, _ ->
                                         ^
kotlin-shell.main.kts:45:45: error: cannot infer type for implicit value parameter 'it'. Specify it explicitly.
                    streamLambda { strm, _, _ ->
                                            ^
kotlin-shell.main.kts:47:45: error: unresolved reference 'read'.
                            val byte = strm.read()
                                            ^
kotlin-shell.main.kts:66:9: error: unresolved reference 'invoke'.
        "wc ${args[0]}"()
        ^

Am I running this the wrong way ?

Same for html script

kotlin kotlinx-html.main.kts 
kotlinx-html.main.kts:18:28: error: unresolved reference 'createHTML'.
import kotlinx.html.stream.createHTML
                           ^
kotlinx-html.main.kts:22:7: error: unresolved reference 'createHTML'.
print(createHTML().html {
      ^
kotlinx-html.main.kts:23:5: error: unresolved reference 'body'.
    body {
    ^
kotlinx-html.main.kts:24:9: error: unresolved reference 'h1'.
        h1 { +"Hello, $addressee!" }
        ^
kotlinx-html.main.kts:24:14: error: unresolved reference 'unaryPlus' for operator '+'.
        h1 { +"Hello, $addressee!" }
             ^

Info

kotlin -version             
Kotlin version 2.2.21-release-469 (JRE 25.0.1+8-27)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions