简体   繁体   English

在 angular 14 中找不到命名空间“google”

[英]Cannot find namespace 'google' in angular 14

@angular/google-maps version: 14.1.1 @angular/google-maps 版本: 14.1.1

I am using angular 14 and implement google map using @angular/google-maps but through error Cannot find namespace 'google'.我正在使用 angular 14 并使用 @angular/google-maps 实现 google map,但通过错误Cannot find namespace 'google'.

Here is stackblitz link click...这是stackblitz链接点击...

Maybe your package doesn't installed successfully.也许您的 package 没有安装成功。 First try this:首先试试这个:

npm install @angular/google-maps --force

After that hard reload your app.之后重新加载您的应用程序。 It will works它会起作用

As mentioned in the doc如文档中所述

The Google Maps JavaScript declaration files (see source files on GitHub) can be installed using NPM from the @types/google.maps package可以使用@types/google.maps package 中的 NPM 安装 Google 地图 JavaScript 声明文件(参见 GitHub 上的源文件)

Try this:尝试这个:

 npm i -D @types/google.maps

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM