Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/411.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 名称空间';google.maps';没有导出的成员';MouseEvent';_Javascript_Angular_Google Maps Api 3_Angular Google Maps - Fatal编程技术网

Javascript 名称空间';google.maps';没有导出的成员';MouseEvent';

Javascript 名称空间';google.maps';没有导出的成员';MouseEvent';,javascript,angular,google-maps-api-3,angular-google-maps,Javascript,Angular,Google Maps Api 3,Angular Google Maps,我想把谷歌地图和我的Angular项目结合起来。在试用版中,我只是按照这个链接进行操作。目前,我陷入了错误: node_modules/@agm/core/lib/directives/map.d.ts:232:43-错误TS2694:命名空间“google.maps”没有导出成员“MouseEvent” 232 mapDblClick:EventEmitter 我去了文件的位置,得到了这个 mapClick: EventEmitter<google.maps.MouseEvent

我想把谷歌地图和我的Angular项目结合起来。在试用版中,我只是按照这个链接进行操作。目前,我陷入了错误:

node_modules/@agm/core/lib/directives/map.d.ts:232:43-错误TS2694:命名空间“google.maps”没有导出成员“MouseEvent”

232 mapDblClick:EventEmitter

我去了文件的位置,得到了这个

    mapClick: EventEmitter<google.maps.MouseEvent | google.maps.IconMouseEvent>;
    /**
     * This event emitter gets emitted when the user right-clicks on the map (but not when they click
     * on a marker or infoWindow).
     */
    mapRightClick: EventEmitter<google.maps.MouseEvent>;
    /**
     * This event emitter gets emitted when the user double-clicks on the map (but not when they click
     * on a marker or infoWindow).
     */
    mapDblClick: EventEmitter<google.maps.MouseEvent>;
    /**
mapClick:EventEmitter;
/**
*此事件发射器在用户右键单击地图时发出(但不是在用户单击时)
*在标记或信息窗口上)。
*/
mapRightClick:EventEmitter;
/**
*此事件发射器在用户双击地图时发出(但不是在用户单击时)
*在标记或信息窗口上)。
*/
mapDblClick:EventEmitter;
/**
依赖项: 在agm/堆芯处安装npm
npm i@types/googlemaps

It解决方案

然后加上

"devDependencies": {
     "@types/googlemaps": "3.39.14"
}    

我发现,如果您使用的是
@agm/core
,则其他一些答案中提到的解决方法不起作用。我在更新到Angular 11时遇到了相同的错误

似乎Angular 11与
@agm/core 3.0.0-beta.0
(最新版本)结合使用时无法正常工作。尝试将
@agm/core
降级到以前的版本
1.1.0
。这对我有用

"dependencies": {
    "@agm/core": "^1.1.0"
}

以上都不适用于我,我的angular版本是10,根据问题,angular团队目前正在处理的@angular/googlemaps和@types/googlemaps的兼容性问题。

伙计们,解决方案已经合并


尝试安装
@类型/googlemaps@3.43.2
来自npm

我对Angular Cli 11和“@agm/core”有相同的问题:“^3.0.0-beta.0”,
我决定将@types/googlemaps:“3.39.12”添加到我的devdependences中,现在它可以工作了

升级到Angular 11后,我开始遇到这个问题


工作环境是;在“node_modules/@agm/core/lib/services/”文件夹中,您需要在几个地方将MapHandlerMap更改为MapMouseeEvent(查看终端日志以查看位置)。

我在Angular 11上遇到了同样的问题。下面是一个对我很好的组合(package.json):


附言:一些教程建议添加@google/maps,但我没有添加该软件包。

降级到@agm/core 1.1.0对我很有效,谢谢。我使用的是@agm/core 3.0.0-beta.0和Angular 9。请查看我的答案,解决方案刚刚合并并发布,不需要更多的变通方法。
"dependencies": {
    "@agm/core": "^1.1.0"
}
"dependencies": {
...
    "@agm/core": "^1.1.0",
... 
}
"devDependencies": {
...
"@types/googlemaps": "^3.39.12",
...
}