You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Angular 9引入@ng-web-apis/geolocation出现导出缺失错误求助

解决Angular 9中@ng-web-apis/geolocation版本不兼容的错误

错误原因

你安装的@ng-web-apis/geolocation版本是为Angular 10及以上版本构建的,该版本依赖了Angular 10才引入的Ivy元数据声明API(如ɵɵngDeclareClassMetadata、ɵɵngDeclareFactory等),而你的Angular 9版本的@angular/core并未提供这些API,因此出现导出找不到的错误。重装node_modules无法解决,因为问题根源是版本不兼容,而非依赖缺失。

解决方案

  • 卸载当前不兼容的版本:
npm uninstall @ng-web-apis/geolocation
  • 安装适配Angular 9的版本(选择v1.x系列,示例版本1.1.0):
npm install @ng-web-apis/geolocation@1.1.0
  • 重新运行项目:
ng serve

内容的提问来源于stack exchange,提问作者Anonymous Coder

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.05 21:25:16