cowbell / cordova-plugin-geofence

Geofencing plugin for cordova
Apache License 2.0
265 stars 317 forks source link

geofence cause ionic 4.0.0.beta3 build error "... Error: Cannot find module '../cordova/platform_metadata' ..." #284

Open jing-zhou opened 6 years ago

jing-zhou commented 6 years ago

problem description Ionic 4.0.0.beta3 project build ('ionic cordova run android') failed with the follow error prompt: (node:9923) UnhandledPromiseRejectionWarning: Error: Cannot find module '../cordova/platform_metadata'

see https://github.com/ionic-team/ionic-native/issues/2667 Steps to reproduce:

1, following https://beta.ionicframework.com/docs to setup the environement 2, start a new project by ionic start myApp tabs --type=angular follow prompt to finish the process, select 'y' to install cordova 3, enter the project folder , type in the following

ionic cordova platform add android
ionic cordova plugin add cordova-plugin-geofence
npm install --save @ionic-native/geofence

4, type in ionic cordova run android and see the build fails and the error occurs

chunk {127} 127.js, 127.js.map () 3.92 kB  [rendered]
chunk {129} 129.js, 129.js.map () 10.5 kB  [rendered]
> cordova run android
Android Studio project detected
(node:9923) UnhandledPromiseRejectionWarning: Error: Cannot find module '../cordova/platform_metadata'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Context.requireCordovaModule (/home/wjz/.nvm/versions/node/v10.7.0/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/Context.js:77:12)
    at module.exports (/home/wjz/ion/uApp/plugins/cordova-plugin-add-swift-support/src/add-swift-support.js:23:34)
    at runScriptViaModuleLoader (/home/wjz/.nvm/versions/node/v10.7.0/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:188:18)
    at runScript (/home/wjz/.nvm/versions/node/v10.7.0/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:164:16)
    at /home/wjz/.nvm/versions/node/v10.7.0/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:132:20
    at _fulfilled (/home/wjz/.nvm/versions/node/v10.7.0/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:787:54)
(node:9923) 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:9923) [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.

environment config summary Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

wjz@bj:~/ion/uApp$ ionic info
✔ Gathering environment info - done!

Ionic:

   ionic (Ionic CLI)          : 4.1.1 (/home/wjz/.nvm/versions/node/v10.7.0/lib/node_modules/ionic)
   Ionic Framework            : @ionic/angular 4.0.0-beta.3
   @angular-devkit/core       : 0.7.4
   @angular-devkit/schematics : 0.7.4
   @angular/cli               : 6.1.4
   @ionic/ng-toolkit          : 1.0.6
   @ionic/schematics-angular  : 1.0.5

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : android 7.0.0
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.2, cordova-plugin-ionic-webview 2.1.0, (and 6 other plugins)

System:

   Android SDK Tools : 26.1.1 (/home/wjz/Android/Sdk)
   NodeJS            : v10.7.0 (/home/wjz/.nvm/versions/node/v10.7.0/bin/node)
   npm               : 6.2.0
   OS                : Linux 4.4

Environment:

   HTTP_PROXY  : http://127.0.0.1:42266/
   http_proxy  : http://127.0.0.1:42266/
   HTTPS_PROXY : http://127.0.0.1:42266/
   https_proxy : http://127.0.0.1:42266/

wjz@bj:~/ion/uApp$ 
jing-zhou commented 6 years ago

this is a bug of the depending plugin 'cordova-plugin-add-swift-support'. upgrade 'cordova-plugin-add-swift-support' to version ^1.7.2 solves the problem see terikon/cordova-plugin-photo-library#124

Muthukumar1996 commented 5 years ago

Hi @jing-zhou i have also facing same issue. Still issue not resolved. I have stuck in this issue last three days. Is there any other solution?.

Ilhamsafeek commented 5 years ago

Hi @jing-zhou i have also facing same issue. Still issue not resolved. I have stuck in this issue last three days. Is there any other solution?.

No Solutions yet. sounds like need to wait until they need to fix

digvijayLogistic commented 4 years ago

Hello @jing-zhou

1) Remove the plugin cordova plugin remove cordova-plugin-geofence 2) Install manually cordova-plugin-add-swift-support cordova plugin add cordova-plugin-add-swift-support --save https://github.com/akofman/cordova-plugin-add-swift-support 3) Install geofence again cordova plugin add cordova-plugin-geofence Enjoy! (The latest swift-support works fine with cordova 8) and also solve your error.

NishithaSurapudi commented 4 years ago

Hello @digvijayLogistic will this work for cordova 9 also..?