Angular7: 找不到类型定义文件

Angular 7: cannot find the type definition file

昨天我的项目运行良好,但今天我在安装 ngx-pagination 模块后遇到错误:

ERROR in src/app/views/dashboard/step1/step1.component.ts(1,23): error TS2688: Cannot find type definition file for '@types/googlemaps'. src/app/views/dashboard/step1/step1.component.ts(187,34): error TS2304: Cannot find name 'google'. src/app/views/dashboard/step1/step1.component.ts(190,29): error TS2304: Cannot find name 'google'. src/app/views/dashboard/step1/step1.component.ts(193,26): error TS2503: Cannot find namespace 'google'. src/app/views/job/quick-job-form/quick-job-form.component.ts(1,23): error TS2688: Cannot find type definition file for '@types/googlemaps'. src/app/views/job/quick-job-form/quick-job-form.component.ts(182,34): error TS2304: Cannot find name 'google'. src/app/views/job/quick-job-form/quick-job-form.component.ts(188,29): error TS2304: Cannot find name 'google'. src/app/views/job/quick-job-form/quick-job-form.component.ts(191,26): error TS2503: Cannot find namespace 'google'. src/app/views/job/quick-job-form/quick-job-form.component.ts(336,24): error TS2304: Cannot find name 'google'.

请帮帮我。

您似乎在 step1.component.ts 文件中使用了 @types/googlemaps,并且错误中列出了其他文件。 使用此命令删除或安装此组件的使用:

npm install --save @types/googlemaps

此包现已弃用,Google 地图浏览器 API 的类型已移至 @types/google.maps:

npm install --save @types/google.maps