使用yeoman发生器Gradle + Kotlin无法生成新项目

时间:2016-04-09 14:58:10

标签: intellij-idea gradle kotlin yeoman-generator

我使用brew install Caskroom/cask/android-studio

在Mac上安装了Android Studio

然后,我运行yo gradle-kotlin,并收到以下错误。我可以做些什么才能让我的第一个Hello World工作?

谢谢

✔ /Volumes/Git/android/kotlin-hello-world 
10:53 $ yo gradle-kotlin

     _-----_
    |       |    .--------------------------.
    |--(o)--|    |      Welcome to the      |
   `---------´   | incredible Gradle+Kotlin |
    ( _´U`_ )    |        generator!        |
    /___A___\    '--------------------------'
     |  ~  |     
   __'.___.'__   
 ´   `  |° ´ Y ` 

  Detecting installed Gradle version...
  Fetching latest Kotlin version from Maven Central...
✔ Fetched latest Kotlin version: 1.0.1-2
✔ Detected installed Gradle version: 2.12
? What's your project name? kotlin hello world
? What Gradle version would you like to use? 2.12
? What Kotlin version would you like to use? 1.0.1-2
? Do you want to use Kotlin Reflection? Yes
? Would you like to use IDEA Gradle plugin? Yes
identical .gitignore
identical src/main/kotlin/.gitkeep
identical src/test/kotlin/.gitkeep
identical build.gradle
identical gradle.properties
identical settings.gradle
  Executing 'gradle wrapper' command...

✔ Done executing 'gradle wrapper' command.
  Executing Gradle tasks: idea build
internal/child_process.js:298
    throw errnoException(err, 'spawn');
    ^

Error: spawn EACCES
  at exports._errnoException (util.js:856:11)
  at ChildProcess.spawn (internal/child_process.js:298:11)
  at Object.exports.spawn (child_process.js:362:9)
  at Function.spawn (/usr/local/lib/node_modules/generator-gradle-kotlin/node_modules/cross-spawn-async/index.js:13:18)
  at spawn (/usr/local/lib/node_modules/generator-gradle-kotlin/node_modules/cross-spawn/index.js:34:23)
  at GradleKotlinGenerator.spawnCommand (/usr/local/lib/node_modules/generator-gradle-kotlin/node_modules/yeoman-generator/lib/actions/spawn_command.js:20:10)
  at ChildProcess.<anonymous> (/usr/local/lib/node_modules/generator-gradle-kotlin/generators/app/gradle-kotlin.coffee:78:8)
  at emitTwo (events.js:100:13)
  at ChildProcess.emit (events.js:185:7)
  at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)

1 个答案:

答案 0 :(得分:1)

我刚修好了。

这是生成器逻辑中特定于OSX的错误,一个相当愚蠢的错误:它错误地检测到平台并试图调用./gradlew.bat,它甚至没有意识到它是.bat文件,原因是EACCES错误实际上是这个.bat没有+ x权限。只需将生成器更新为1.1.1,它应该没问题。