Ionic pro包构建失败

时间:2018-06-12 14:02:41

标签: ionic-framework ionic-native

在Android内置程序包中获取错误。

无法恢复插件" cordova-plugin-ionic"来自config.xml



Saved plugin info for "cordova-plugin-ionic" to config.xml
Failed to restore plugin "cordova-plugin-ionic" from config.xml. You might need to try adding it again. Error: TypeError: Invalid data, chunk must be a string or buffer, not object
(node:1) UnhandledPromiseRejectionWarning: TypeError: Invalid data, chunk must be a string or buffer, not object
    at Socket.write (net.js:714:11)
    at Socket.stream.write (/usr/local/lib/node_modules/cordova/node_modules/ansi/lib/newlines.js:36:21)
    at Object. (/usr/src/app/plugins/cordova-plugin-fcm/scripts/fcm_config_files_process.js:80:24)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1) [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.
cordova platform add android --no-fetch failed
Running after script...
$ run "clean-up"
Running Stage clean-up for Job: 5622469
ERROR: Job failed: exit status 1
 Build failedJob ID: 5622469
Android - debug build




构建失败!

我已按照以下步骤操作..

  1. 删除应用的node_modules / dir

  2. 删除应用程序的package-lock.json文件(如果存在)

  3. 删除应用的平台/目录

  4. 删除应用的插件/目录

  5. 运行npm install

  6. 运行npm run build

  7. (一切正常!)

    但是,它在运行时会出现同样的错误 - ionic cordova platform add android

    图片的附加图片

    1。错误消息

    enter image description here

    2。离子信息

    enter image description here

1 个答案:

答案 0 :(得分:0)

Ionic支持团队的回答解决了我的问题。

问题的根源是cordova-plugin-fcm。该插件在很长一段时间内没有更新,可能不支持cordova-android 7.0.0+。

首先要尝试:恢复到cordova-android 6.4.0并重试你的构建。这可能允许fcm插件正确安装,而不会干扰项目的目录结构。

或者(一般情况下),我建议切换到提供相同功能并积极维护的cordova-plugin-firebase

Android平台的基础目录结构随cordova-android 7.0而改变。如果您的插件尚未经过调整以便与新结构一起使用,则可能会出现问题。

尝试其中一个选项。

它有效!恢复到cordova-android 6.4.0并重试构建是解决问题的方法。