akofman / cordova-plugin-add-swift-support

:hammer: Swiftify your Cordova app !
MIT License
116 stars 107 forks source link

Unhandled promise rejection (rejection id: 1): Error: Cannot find module '../cordova/platform_metadata' #44

Closed jonathanwkelly closed 6 years ago

jonathanwkelly commented 6 years ago

When I attempt to build the project, I get the following error. I've upgraded, uninstalled, re-installed node, npm, cordova-cli, ionic. Any ideas?

$ cordova build android --verbose

No scripts found for hook "before_build".
No scripts found for hook "before_prepare".
Checking config.xml and package.json for saved platforms that haven't been added to the project
PlatformApi successfully found for platform android
Android Studio project detected
Checking config.xml for saved plugins that haven't been added to the project
Checking for any plugins added to the project that have not been installed in android platform
No differences found between plugins added to project and installed in android platform. Continuing...
Generating platform-specific config.xml from defaults for android at /Development/BallFrog/BallFrog/platforms/android/app/src/main/res/xml/config.xml
Merging project's config.xml into platform-specific android config.xml
Merging and updating files from [www, platforms/android/platform_www] to platforms/android/app/src/main/assets/www
Wrote out android application name "BallFrog" to /Development/BallFrog/BallFrog/platforms/android/app/src/main/res/values/strings.xml
android-versionCode not found in config.xml. Generating a code based on version in config.xml (0.0.1): 1
Wrote out Android package name "io.ionic.starter" to /Development/BallFrog/BallFrog/platforms/android/app/src/main/java/io/ionic/starter/MainActivity.java
Updating icons at platforms/android/app/src/main/res
Updating splash screens at platforms/android/app/src/main/res
This app does not have additional resource files defined
Prepared android project successfully
Executing script found in plugin cordova-plugin-add-swift-support for hook "after_prepare": plugins/cordova-plugin-add-swift-support/add-swift-support.js
Resolving module name for cordova-lib/src/cordova/platform_metadata => ../cordova/platform_metadata
(node:16206) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Cannot find module '../cordova/platform_metadata'
(node:16206) [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.

Ionic Info

cli packages: (/Development/BallFrog/BallFrog/node_modules)

    @ionic/cli-utils  : 1.19.0
    ionic (Ionic CLI) : 3.19.0

global packages:

    cordova (Cordova CLI) : 8.0.0

local packages:

    @ionic/app-scripts : 3.1.2
    Cordova Platforms  : android 7.0.0 ios 4.5.4
    Ionic Framework    : ionic-angular 3.9.2

System:

    Node  : v9.2.1
    npm   : 5.6.0
    OS    : macOS High Sierra
    Xcode : Xcode 9.2 Build version 9C32c

Environment Variables:

    ANDROID_HOME : ~/Library/Android/sdk

Misc:

    backend : pro
akofman commented 6 years ago

Hello, Should be fixed with version 1.7.1.

jonathanwkelly commented 6 years ago

@akofman the issue is not resolved after I remove the cordova-plugin-add-swift-support plugin, re-add, then attempt to build. The output is exactly the same.

Were you able to reproduce this issue?

akofman commented 6 years ago

I didn't try with ionic in particular but I didn't have any issue anymore on a pure Cordova project. Did you check the version of the plugin after you re-add it ? Also maybe you have to clear your package-lock.json before.