我想在一个离子电容器Angular 项目中包含Google Maps,所以我按照他们的documentation来做。但是当我构建时,我得到了以下错误:
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" />
我到处搜索,检查文档,甚至按照这个stack overflow question中的答案,似乎没有帮助:
最新消息:
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"
}
2条答案
按热度按时间jjjwad0x1#
原来这是他们的新版本4.3.0中的bug,将包降级到4.2.1修复了这个问题:npm i @电容器/谷歌Map@4.2.1
ssgvzors2#
你可以试试
1.删除package-lock.json
1.删除node_modules文件夹
1.运行npm安装
或当您有需要稍后解决的依赖性问题时