【问题标题】:ionic 3 - UnhandledPromiseRejectionWarning when generating android buildionic 3 - 生成android构建时出现UnhandledPromiseRejectionWarning
【发布时间】:2018-01-11 10:18:32
【问题描述】:

我正在使用 ionic 3.19,当我尝试创建一个 android 版本时,它出现以下错误。用 ios 就好了。这是什么问题以及如何解决?

我正在使用节点 v8.9.1。

(node:49779) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: spawn EACCES

这是执行和问题输出

$ ionic cordova build android --release
Running app-scripts build: --platform android --target cordova
[18:01:13]  build dev started ... 
[18:01:13]  clean started ... 
[18:01:13]  clean finished in 6 ms 
[18:01:13]  copy started ... 
[18:01:13]  deeplinks started ... 
[18:01:13]  deeplinks finished in 97 ms 
[18:01:13]  transpile started ... 
[18:01:17]  transpile finished in 4.06 s 
[18:01:17]  preprocess started ... 
[18:01:17]  preprocess finished in less than 1 ms 
[18:01:17]  webpack started ... 
[18:01:17]  copy finished in 4.30 s 
[18:01:25]  webpack finished in 7.47 s 
[18:01:25]  sass started ... 
Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.
[18:01:26]  sass finished in 1.26 s 
[18:01:26]  postprocess started ... 
[18:01:26]  postprocess finished in 13 ms 
[18:01:26]  lint started ... 
[18:01:26]  build dev finished in 13.04 s 
> cordova build android --release
ANDROID_HOME=/Users/megasap/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_71.jdk/Contents/Home
(node:49779) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: spawn EACCES
(node:49779) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

[18:01:29]  tslint: src/pages/attandance-detail/attandance-detail.ts, line: 175 
            'marker' is declared but never used. 

     L174:  console.log(location)
     L175:  let marker = new google.maps.Marker({
     L176:      position: location,

[18:01:29]  tslint: src/pages/home/home.ts, line: 260 
            'marker' is declared but never used. 

     L259:  addMarker(location, map) {
     L260:      let marker = new google.maps.Marker({
     L261:          position: location,

[18:01:29]  lint finished in 3.00 s 

更新: 这是节点 v9.4.0 的执行和错误。这比之前在节点 v8.9.1 上运行的要详细一些。 https://gist.github.com/axilaris/4cc7094c7dae28477eb2f348e53fad91

【问题讨论】:

  • 你解决了吗?
  • 是的!等一下

标签: android build apk ionic3


【解决方案1】:

这成功了!

sudo chmod 777 /Applications/Android\ Studio.app/Contents/gradle/gradle-4.1/bin/gradle

【讨论】:

  • 谢谢!对于这个 simlpe 问题,这是一个可怕的错误消息:/
  • chmod +x .../bin/gradle 会更干净
  • 如果有人用windows那又怎样?
【解决方案2】:

我刚刚遇到这个问题,在更新 Android Studio 并将 gradle 从 4.1 更新到 4.4 之后,我不得不更新我的环境变量并转到新的 gradle 位置 /opt/android-studio/gradle/gradle-4.4/bin 并执行 chmod 777 gradle

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-24
    • 2018-06-08
    • 2019-11-03
    • 2018-07-31
    • 2019-03-20
    • 2019-01-02
    相关资源
    最近更新 更多