【问题标题】:How do I fix permission to allow IntelliJ IDEA to run a Kotlin script?如何修复允许 IntelliJ IDEA 运行 Kotlin 脚本的权限?
【发布时间】:2021-01-28 16:56:59
【问题描述】:

我正在尝试在 Mac OS 10.15.7 上从 IntelliJ IDEA 2020.3.1 运行以下 Kotlin 脚本。该脚本在终端上运行良好,但是当我点击 IntelliJ 内的“运行”按钮时,出现以下错误:

zsh:权限被拒绝:/Users/*****/scripts/first.main.kts

解决此权限问题的正确方法是什么?

#!/usr/bin/env kotlin

@file:Repository("https://jcenter.bintray.com")
@file:DependsOn("org.http4k:http4k-bom:4.1.1.2")
@file:DependsOn("org.http4k:http4k-core:4.1.1.2")
@file:DependsOn("org.http4k:http4k-client-apache:4.1.1.2")
@file:DependsOn("org.http4k:http4k-server-netty:4.1.1.2")


import org.http4k.client.ApacheClient
import org.http4k.core.Method
import org.http4k.core.Request


val client = ApacheClient()

val request = Request(Method.GET, "https://api.kanye.rest/").query("format", "text")

println(client(request))

【问题讨论】:

    标签: kotlin intellij-idea zsh


    【解决方案1】:

    您必须使文件可执行:chmod +x first.main.kts

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-09
      • 1970-01-01
      • 2011-05-09
      • 2017-09-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多