0

I'm doing this tutorial on Google Maps into Ionic and I did everything, amended other mistakes but I get this error:

[14:33:14] transpile started ... [14:33:27] typescript: ...ncisco/ionic/ionic-google-maps-example/src/components/google-maps/google-maps.ts, line: 157 Cannot find name 'google'.

L157: let latLng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);

[14:33:27] typescript: ...ncisco/ionic/ionic-google-maps-example/src/components/google-maps/google-maps.ts, line: 164 Cannot find name 'google'.

L164: this.map = new google.maps.Map(this.element.nativeElement, mapOptions); L165: resolve(true);

I followed the advice from the tutorial and ran:

npm install @types/googlemaps --save-dev

However, it didn't change anything. I've seen other post suggesting running a command with typings to install it but still it doesn't see it.

ffuentes
  • 1,042
  • 5
  • 16
  • 36
  • can you post your `types` entry from both your `tsconfig.json` and `tsconfig-app.json` ? Maybe try explicitly defining the types there. Also, if using the CLI, try killing your server and re-serving the app to rebuild what types are imported. Also, can you post which version of Angular you're using? – joh04667 Jan 29 '19 at 18:13
  • my tsconfig.json doesn't have a types section. How do I set that? – ffuentes Jan 29 '19 at 18:19
  • My angular version in package.json is 5.2 – ffuentes Jan 29 '19 at 18:21
  • By deafult, it's the `typeRoots` entry. Sorry, should have clarified that. – joh04667 Jan 29 '19 at 19:30
  • Related to https://stackoverflow.com/questions/51084724/types-googlemaps-index-d-ts-is-not-a-module/51169121#51169121 -- has solutions for both ng 5 and 6 – Nathan Beck Jan 29 '19 at 20:02
  • do you have google required into your project in main.ts or vendor.ts. You have the package, but that just means it's in your node_modules. You also need to require the package to bring it into your project. – Kellie Hall Jan 29 '19 at 20:35

0 Answers0