【问题标题】:Ionic Cordova Will Not Build, But Shows No ErrorsIonic Cordova 不会构建,但不会显示错误
【发布时间】:2018-09-07 01:31:25
【问题描述】:

我刚刚制作了一个“新”离子应用程序,但我无法让 cordova 构建 APK。我将 new 放在引号中,因为我创建了一个新项目并从以前的项目中复制了 src。该项目上的插件安装的依赖项出现了严重错误,因此我决定从一个干净的开始。

我开始了新项目并安装了我需要的所有插件。它似乎在浏览器中按预期工作。

当我运行ionic cordova build android 时,输出如下:

PS D:\Ionic\PigsNBulls\PigsNBulls> ionic cordova build android
> ionic-app-scripts build --target cordova --platform android
[20:21:27]  ionic-app-scripts 3.2.0
[20:21:27]  build dev started ...
[20:21:27]  clean started ...
[20:21:27]  clean finished in 16 ms
[20:21:27]  copy started ...
[20:21:27]  deeplinks started ...
[20:21:27]  deeplinks finished in 111 ms
[20:21:27]  transpile started ...
[20:21:31]  transpile finished in 3.56 s
[20:21:31]  preprocess started ...
[20:21:31]  preprocess finished in 3 ms
[20:21:31]  webpack started ...
[20:21:31]  copy finished in 3.84 s
[20:21:36]  webpack finished in 5.03 s
[20:21:36]  sass started ...
[20:21:37]  sass finished in 1.24 s
[20:21:37]  postprocess started ...
[20:21:37]  postprocess finished in 12 ms
[20:21:37]  lint started ...
[20:21:37]  build dev finished in 10.14 s
[20:21:40]  lint finished in 3.12 s
> cordova build android
Android Studio project detected
(node:16624) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Invalid data, chunk must be a string or buffer, not object
(node:16624) [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.
PS D:\Ionic\PigsNBulls\PigsNBulls>

在这个新项目之前运行良好。

【问题讨论】:

  • 你用的是什么插件?您是否尝试过删除并读取您的 android 平台和插件?
  • 我可以知道你的cordova版本吗?

标签: android cordova ionic-framework ionic3


【解决方案1】:

我认为您可能拥有导致上述错误的最新 cordova 8.0.0。请使用以下命令:

npm install -g cordova@7.1.0

【讨论】: