运行ionic4项目的时候提示以下错误:

cordova plugin add cordova-plugin-photo-library --variable PHOTO_LIBRARY_USAGE_DESCRIPTION="To choose photos" --save Installing "cordova-plugin-photo-library" for ios Installing "cordova-plugin-file" for ios Installing "cordova-plugin-compat" for ios Installing "cordova-plugin-add-swift-support" for ios Adding cordova-plugin-photo-library to package.json Saved plugin info for "cordova-plugin-photo-library" to config.xml (node:61839) UnhandledPromiseRejectionWarning: Error: Cannot find module '../cordova/platform_metadata' at Function.Module._resolveFilename (module.js:543:15) at Function.Module._load (module.js:470:25) at Module.require (module.js:593:17) at require (internal/module.js:11:18) at Context.requireCordovaModule (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/Context.js:77:12) at module.exports (/Users/ptkdev/cordova/meingifs/plugins/cordova-plugin-add-swift-support/src/add-swift-support.js:23:34)

错误原因:

主要是因为插件cordova-plugin-add-swift-support导致的。

解决办法:

升级即可、

cordova plugin rm cordova-plugin-add-swift-support --force
cordova plugin add cordova-plugin-add-swift-support