简体   繁体   English

如何修复允许 IntelliJ IDEA 运行 Kotlin 脚本的权限?

[英]How do I fix permission to allow IntelliJ IDEA to run a Kotlin script?

I am trying to run the below Kotlin script from IntelliJ IDEA 2020.3.1 on Mac OS 10.15.7.我正在尝试在 Mac OS 10.15.7 上从 IntelliJ IDEA 2020.3.1 运行以下 Kotlin 脚本。 The script runs fine from terminal, but when I hit the 'run' button inside of IntelliJ, I get the following error:该脚本从终端运行良好,但是当我点击 IntelliJ 内的“运行”按钮时,出现以下错误:

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

What would be the right way to fix this permission issue?解决此权限问题的正确方法是什么?

#!/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))

You must make the file executable: chmod +x first.main.kts您必须使文件可执行: chmod +x first.main.kts

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 尝试在IntelliJ IDEA中运行Kotlin脚本 - Trying to run Kotlin script in IntelliJ IDEA 如何修复IntelliJ IDEA中冲突的Kotlin依赖? - How to fix conflicting Kotlin dependency in IntelliJ IDEA? 如何在 Intellij Idea 中从 GitHub 打开 Kotlin 文件? - How do I open Kotlin file from GitHub in Intellij Idea? 如何在Intellij Idea中运行Kotlin函数 - How to run Kotlin function in Intellij Idea IntelliJ Kotlin - 如何修复项目中的“确保您依赖于 Kotlin 标准库”? - IntelliJ Kotlin - How do I fix "Ensure that you have a dependency on the Kotlin standard library" in a project? 如何在 IntelliJ IDEA/Gradle 项目中使用 Java `package-info.java` 记录 Kotlin 包? - How do I document a Kotlin package like with the Java `package-info.java` in an IntelliJ IDEA/Gradle project? 如何在 IntelliJ IDEA 中禁用“粘贴时将 Java 转换为 Kotlin”? - How do I disable 'Convert Java to Kotlin upon paste' in IntelliJ IDEA? 如何获得IntelliJ IDEA代码完成功能,以将静态Java方法导入为Kotlin顶层函数? - How do I get IntelliJ IDEA code completion to import static Java methods as Kotlin top level functions? 当我在 IntelliJ Idea 中单击 Kotlin Repl 时,window 永远不会打开。 什么都没发生。 请任何人告诉我如何解决这个问题 - When i click on the Kotlin Repl in IntelliJ Idea , the window never opens . Nothing happens . Please anyone tell me how to fix this 无法在IntelliJ Idea中运行或调试Kotlin - Cant Run or Debug Kotlin In IntelliJ Idea
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM