I want to include Google Maps in an ionic capacitor angular project so I followed their documentation to do so. But when I build I get the following error:
Error: node_modules/@capacitor/google-maps/dist/typings/definitions.d.ts:1:23 - error TS2688: Cannot find type definition file for 'google.maps'.
[ng] 1 /// <reference types="google.maps" />
I searched everywhere, checked the documentation, even followed the answers in this stack overflow question none which seemed to help:
UPDATE:
package.json
{
"name": "Project",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "https://ionicframework.com/",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^14.2.5",
"@angular/cdk": "^14.2.4",
"@angular/common": "^14.0.0",
"@angular/core": "^14.0.0",
"@angular/forms": "^14.0.0",
"@angular/material": "^14.0.4",
"@angular/platform-browser": "^14.0.0",
"@angular/platform-browser-dynamic": "^14.0.0",
"@angular/router": "^14.0.0",
"@capacitor/android": "4.1.0",
"@capacitor/app": "^4.1.0",
"@capacitor/browser": "^4.0.1",
"@capacitor/camera": "^4.1.3",
"@capacitor/core": "^4.3.0",
"@capacitor/geolocation": "^4.0.1",
"@capacitor/google-maps": "^4.3.0",
"@capacitor/haptics": "^4.0.1",
"@capacitor/ios": "^4.3.0",
"@capacitor/keyboard": "^4.0.1",
"@capacitor/status-bar": "^4.0.1",
"@ionic-native/core": "^5.36.0",
"@ionic/angular": "^6.1.12",
"@ionic/pwa-elements": "^3.1.1",
"@ionic/storage": "^3.0.6",
"ngx-color-picker": "^13.0.0",
"rxjs": "~6.6.0",
"swiper": "^8.4.4",
"tslib": "^2.2.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "^14.0.0",
"@angular-eslint/builder": "~13.0.1",
"@angular-eslint/eslint-plugin": "~13.0.1",
"@angular-eslint/eslint-plugin-template": "~13.0.1",
"@angular-eslint/template-parser": "~13.0.1",
"@angular/cli": "^14.0.0",
"@angular/compiler": "^14.0.0",
"@angular/compiler-cli": "^14.0.0",
"@angular/language-service": "^14.0.0",
"@capacitor/cli": "^4.1.0",
"@ionic/angular-toolkit": "^6.0.0",
"@ionic/lab": "3.2.13",
"@types/googlemaps": "^3.43.3",
"@types/jasmine": "~3.6.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.11.1",
"@typescript-eslint/eslint-plugin": "5.3.0",
"@typescript-eslint/parser": "5.3.0",
"eslint": "^7.6.0",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-jsdoc": "30.7.6",
"eslint-plugin-prefer-arrow": "1.2.2",
"jasmine-core": "~3.8.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~6.3.2",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"typescript": "~4.7.3"
},
"description": "An Ionic project"
}
CodePudding user response:
You could try:
- Delete package-lock.json
- delete node_modules Folder
- Run npm install
or when you have dependencie Problems that you want to fix later
npm install -f
CodePudding user response:
Turns out that this is a bug in their new version 4.3.0, downgrading the package to 4.2.1 fixed the issue: npm i @capacitor/[email protected]