Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova 8 + iOS 4.5.4 = cannot find module "../cordova/platform_metadata"

Tags:

ios

cordova

Since the latest update to v8 of Cordova, I cannot build anything on Mac. I always get

(node 626) UnhandledPromiseRejectionWarning: Error: Cannot find module '../cordova/platform_metadata'

I tried what was suggested in this post but I get the same error.

I then did a verbose and it seems like the plugin required to build for ios is not working well

Executing script found in plugin cordova-plugin-swift-support for hook "after_prepare": plugins/cordova-plugin-swift-support/src/add-swift-support.js
Resolving module name for cordova-lib/src/cordova/platform_metadata => ../cordova/platform_metadata
(node:599) UnhandledPromiseRejectionWarning: Unhandled promise rejection 
(rejection id: 1): Error: Cannot find module '../cordova/platform_metadata'
(node:599) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.
like image 935
Eric Avatar asked Jan 04 '18 01:01

Eric


3 Answers

This was a bug in cordova-plugin-add-swift-support, just update it to latest version (1.7.1)

cordova plugin rm cordova-plugin-add-swift-support
cordova plugin add cordova-plugin-add-swift-support
like image 108
jcesarmobile Avatar answered Oct 17 '22 06:10

jcesarmobile


you need to downgrade cordova 7.1.0 until this issue is fixed. Do this:

 npm uninstall -g cordova
 npm install -g [email protected]

 cordova platform remove ios
 cordova platform add ios
like image 11
Ajay Reddy Avatar answered Oct 17 '22 06:10

Ajay Reddy


If your running an ionic project that requires the swift plugin you'll need to add the --force flag:

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

Then run:

ionic cordova plugin add cordova-plugin-add-swift-support
like image 3
Max Knox Avatar answered Oct 17 '22 04:10

Max Knox