Ionic pro 包构建失败

Ionic pro package build failed

包 Android 构建中出现错误。

无法从 config.xml

恢复插件 "cordova-plugin-ionic"

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/ 目录

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

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

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

  5. 运行 npm install

  6. 运行 npm 运行 build

(一切正常!)

但是,它在 运行ning - ionic cordova platform add android

时给出了同样的错误

..的附加图片

1.错误信息

2。离子信息

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 并重试构建是问题的解决方案。