Ionic-native: Ionic 2 RC: GoogleMaps plugin not working

Created on 4 Oct 2016  路  18Comments  路  Source: ionic-team/ionic-native

Hi,

I'm updating a proyect that makes use of Geolocation and GoogleMaps native plugins to RC0.

I've added android platform to the new project, and installed both plugins. However, when I try to build, after linting (no errors) I get a "bundle prod failed" error with the following information:

bundle prod failed: Module /home/kaik/work/courseIonic2DONE/geolocationAppRC0/node_modules/ionic-native/dist/index.js does not export GoogleMap (imported by /home/kaik/work/courseIonic2DONE/geolocationAppRC0/.tmp/pages/map/map.js)

So my app build process fails.

Looks like there's an issue exporting GoogleMap class.

I'll copy the whole output here:

Running 'build:before' npm script before build
> ionic-hello-world@ build /home/kaik/work/courseIonic2DONE/geolocationAppRC0
> ionic-app-scripts build
[00:43:31]  ionic-app-scripts 0.0.28
[00:43:31]  build prod started ...
[00:43:31]  clean started ...
[00:43:31]  clean finished in 14 ms
[00:43:31]  copy started ...
[00:43:31]  ngc started ...
[00:43:31]  lint started ...
[00:43:31]  copy finished in 117 ms
[00:43:32]  lint finished in 1.21 s
[00:43:58]  ngc finished in 27.02 s
[00:43:58]  bundle prod started ...
[00:44:09]  bundle prod failed:  Module /home/kaik/work/courseIonic2DONE/geolocationAppRC0/node_modules/ionic-native/dist/index.js does not export GoogleMap (imported by /home/kaik/work/courseIonic2DONE/geolocationAppRC0/.tmp/pages/map/map.js)

[00:44:09]  bundle prod failed:  Module /home/kaik/work/courseIonic2DONE/geolocationAppRC0/node_modules/ionic-native/dist/index.js does not export GoogleMap (imported by /home/kaik/work/courseIonic2DONE/geolocationAppRC0/.tmp/pages/map/map.js)

[00:44:09]  Error: Module /home/kaik/work/courseIonic2DONE/geolocationAppRC0/node_modules/ionic-native/dist/index.js does not export GoogleMap (imported by /home/kaik/work/courseIonic2DONE/geolocationAppRC0/.tmp/pages/map/map.js)
    at Module.trace (/home/kaik/work/courseIonic2DONE/geolocationAppRC0/node_modules/rollup/dist/rollup.js:7706:29)
    at ModuleScope.findDeclaration (/home/kaik/work/courseIonic2DONE/geolocationAppRC0/node_modules/rollup/dist/rollup.js:7329:22)
    at Scope.findDeclaration (/home/kaik/work/courseIonic2DONE/geolocationAppRC0/node_modules/rollup/dist/rollup.js:5349:39)
    at Scope.findDeclaration (/home/kaik/work/courseIonic2DONE/geolocationAppRC0/node_modules/rollup/dist/rollup.js:5349:39)
    at Scope.findDeclaration (/home/kaik/work/courseIonic2DONE/geolocationAppRC0/node_modules/rollup/dist/rollup.js:5349:39)
    at MemberExpression.bind (/home/kaik/work/courseIonic2DONE/geolocationAppRC0/node_modules/rollup/dist/rollup.js:6695:28)
    at /home/kaik/work/courseIonic2DONE/geolocationAppRC0/node_modules/rollup/dist/rollup.js:5149:50
    at CallExpression.eachChild (/home/kaik/work/courseIonic2DONE/geolocationAppRC0/node_modules/rollup/dist/rollup.js:5166:5)
    at CallExpression.bind (/home/kaik/work/courseIonic2DONE/geolocationAppRC0/node_modules/rollup/dist/rollup.js:5149:7)
    at CallExpression.bind (/home/kaik/work/courseIonic2DONE/geolocationAppRC0/node_modules/rollup/dist/rollup.js:5850:23)

Error running ionic app script "build": Error: Module /home/kaik/work/courseIonic2DONE/geolocationAppRC0/node_modules/ionic-native/dist/index.js does not export GoogleMap (imported by /home/kaik/work/courseIonic2DONE/geolocationAppRC0/.tmp/pages/map/map.js)



npm
 ERR! Linux 3.19.0-25-generic
npm ERR! argv "/home/kaik/.nvm/versions/node/v6.3.1/bin/node" "/home/kaik/.nvm/versions/node/v6.3.1/bin/npm" "run" "build"
npm ERR! node v6.3.1
npm
 ERR! npm  v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! ionic-hello-world@ build: `ionic-app-scripts build`
npm ERR! Exit status 1
npm ERR! 
npm
 ERR! Failed at the ionic-hello-world@ build script 'ionic-app-scripts build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ionic-hello-world package,
npm ERR! not with npm itself.
npm 
ERR! Tell the author that this fails on your system:
npm ERR!     ionic-app-scripts build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!
     npm bugs ionic-hello-world
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls ionic-hello-world
npm ERR! There is likely additional logging output above.



npm ERR! Please include the following file with any support request:
npm ERR!     /home/kaik/work/courseIonic2DONE/geolocationAppRC0/npm-debug.log

Caught exception:
 undefined 

Mind letting us know? https://github.com/driftyco/ionic-cli/issues

Most helpful comment

Okay, I can reproduce after referencing it in the code rather than just importing it. Going to revert the last few ionic-native releases to the one that was working with the build.

All 18 comments

Hey, I just tested this and it's importing fine for me. Can you share more about your project? Perhaps something I can check out online. Or, how are you importing the project?

Can you also try doing an npm install to fetch the newest ionic-native before doing the build again?

If you run npm show ionic-native version what do you see? You should see 2.1.1

Same Problem here after Updated to 2.1.1 with Geolocation

@mlynch yes I have the same issue since upgrading from ionic-native 2.0.3 to 2.1.1

Hey guys, what version of @ionic/app-scripts do you have? run npm view @ionic/app-scripts version to see. You should be on 0.0.28, if not do an update (npm install)

"ionic-native": "^2.1.1",
"@ionic/app-scripts": "^0.0.28",

@mlynch yes I have 0.0.28. But same issue:

[02:48:09]  bundle dev started ...
[02:48:16]  bundle dev failed:  Module C:\xampp\htdocs\node_modules\ionic-native\dist\index.js does not export Geolocation (imported by C:\xampp\htdocs\.tmp\pages\home\home.js)
[02:48:16]  bundle dev failed:  Module C:\xampp\htdocs\node_modules\ionic-native\dist\index.js does not export Geolocation (imported by C:\xampp\htdocs\.tmp\pages\home\home.js)

[02:48:16]  Error: Module C:\xampp\htdocs\node_modules\ionic-native\dist\index.js does not export Geolocation (imported by C:\xampp\htdocs\.tmp\pages\home\home.js)
    at Module.trace (C:\xampp\htdocs\node_modules\rollup\dist\rollup.js:7706:29)
    at ModuleScope.findDeclaration (C:\xampp\htdocs\node_modules\rollup\dist\rollup.js:7329:22)
    at Scope.findDeclaration (C:\xampp\htdocs\node_modules\rollup\dist\rollup.js:5349:39)
    at Scope.findDeclaration (C:\xampp\htdocs\node_modules\rollup\dist\rollup.js:5349:39)
    at MemberExpression.bind (C:\xampp\htdocs\node_modules\rollup\dist\rollup.js:6695:28)
    at C:\xampp\htdocs\node_modules\rollup\dist\rollup.js:5149:50
    at CallExpression.eachChild (C:\xampp\htdocs\node_modules\rollup\dist\rollup.js:5166:5)
    at CallExpression.bind (C:\xampp\htdocs\node_modules\rollup\dist\rollup.js:5149:7)
    at CallExpression.bind (C:\xampp\htdocs\node_modules\rollup\dist\rollup.js:5850:23)
    at C:\xampp\htdocs\node_modules\rollup\dist\rollup.js:5149:50

Can you share a snippet of code where you're using Geolocation and importing from ionic-native?

This is my home.ts (first page on app)
import {Geolocation} from 'ionic-native';

let locationOptions = {timeout: 10000, enableHighAccuracy: true};

    Geolocation.getCurrentPosition(locationOptions).then(
      (position) => {
     },
      (error) =>{

      }
    )

@danielehrhardt This code exec on deviceready?

Okay, I can reproduce after referencing it in the code rather than just importing it. Going to revert the last few ionic-native releases to the one that was working with the build.

haha @mlynch the first thing I do if everything is mostly stable is writing tests :+1:
I think at the moment or before in beta 11 it would be wasted time to write tests because everything could change (and changed as we see).

So then if everybody can work with rc0 now and can help you writing test then this problems shouldn't happen again. This is a moment where everybody can see that this automatic travis / jenkins builds are really really helpful :+1:

Thank you very much @mlynch for your effort.

I don't know which mix of all of the plugins/node/npm/ionic/ionic-native I should be using... seems like everything I try ends up in some unique error case.

@Bubelbub yep, tests are great. In this case the new releases were not properly exporting symbols in a way that worked with es2015 modules that we use in Ionic 2 so it was a bit of a hard thing to test for.

Everyone: I just unpublished the last two versions of ionic-native (well, really just one version since 2.1.0 and 2.1.1 were separated by a single commit). if you do an npm install you should get version 2.0.3 which should work. We are looking into publishing the new versions again with this working for the build tomorrow.

Can someone confirm that 2.0.3 works fine for them? Thanks.

Yes works very fine :+1:
Thank you!

Yes 2.0.3 with app Script 0.0.28 is working!!

I'm having a similar issue but with going from 1.3.10 to 2.0.3 with importing GoogleMapsLatLng.

node_modules/ionic-native/dist/index.js does not export GoogleMapsLatLng

It worked in 1.3.10 but does not work after upgrading. Is there a new place to import GoogleMapsLatLng from?

Please update to [email protected] and let me know if you're still having this issue.

Was this page helpful?
0 / 5 - 0 ratings