Dart SDK 2.9以下运行AngularDart应用 Chrome报错解决方案

简介: Unhandled error detected in the injected client.js script.NoSuchMethodError: method not found: 'get$digestsPath' (J.getInterceptor$x(...).get$digestsPath is not a function)

Chrome浏览器运行AngularDart项目报错,控制台打印类似如下信息:

Unhandled error detected in the injected client.js script.

You can disable this script in webdev by passing --no-injected-client if it
is preventing your app from loading, but note that this will also prevent
all debugging and hot reload/restart functionality from working.

The original error is below, please file an issue at
https://github.com/dart-lang/webdev/issues/new and attach this output:

NoSuchMethodError: method not found: 'get$digestsPath' (J.getInterceptor$x(...).get$digestsPath is not a function)
TypeError: J.getInterceptor$x(...).get$digestsPath is not a function
    at Object.get$digestsPath$x (http://localhost:53322/dwds/src/injected/client.js:3507:43)
    at http://localhost:53322/dwds/src/injected/client.js:22732:60
    at _wrapJsFunctionForAsync_closure.$protected (http://localhost:53322/dwds/src/injected/client.js:3802:15)
    at _wrapJsFunctionForAsync_closure.call$2 (http://localhost:53322/dwds/src/injected/client.js:10996:12)
    at Object._asyncStartSync (http://localhost:53322/dwds/src/injected/client.js:3766:20)
    at RequireRestarter._getDigests$0 (http://localhost:53322/dwds/src/injected/client.js:22744:16)
    at http://localhost:53322/dwds/src/injected/client.js:22759:48
    at _wrapJsFunctionForAsync_closure.$protected (http://localhost:53322/dwds/src/injected/client.js:3802:15)
    at _wrapJsFunctionForAsync_closure.call$2 (http://localhost:53322/dwds/src/injected/client.js:10996:12)
    at Object._asyncStartSync (http://localhost:53322/dwds/src/injected/client.js:3766:20)
    at RequireRestarter._initialize$0 (http://localhost:53322/dwds/src/injected/client.js:22767:16)
    at http://localhost:53322/dwds/src/injected/client.js:8572:45
    at _wrapJsFunctionForAsync_closure.$protected (http://localhost:53322/dwds/src/injected/client.js:3802:15)
    at _wrapJsFunctionForAsync_closure.call$2 (http://localhost:53322/dwds/src/injected/client.js:10996:12)
    at Object._asyncStartSync (http://localhost:53322/dwds/src/injected/client.js:3766:20)
    at Object.RequireRestarter_create (http://localhost:53322/dwds/src/injected/client.js:8584:16)
    at http://localhost:53322/dwds/src/injected/client.js:22319:38
    at _wrapJsFunctionForAsync_closure.$protected (http://localhost:53322/dwds/src/injected/client.js:3802:15)
    at _wrapJsFunctionForAsync_closure.call$2 (http://localhost:53322/dwds/src/injected/client.js:10996:12)
    at _awaitOnObject_closure.call$1 (http://localhost:53322/dwds/src/injected/client.js:10982:32)
    at StaticClosure._rootRunUnary [as call$2$5](http://localhost:53322/dwds/src/injected/client.js:4130:18)
    at _CustomZone.runUnary$2$2 (http://localhost:53322/dwds/src/injected/client.js:12301:39)
    at _Future__propagateToListeners_handleValueCallback.call$0 (http://localhost:53322/dwds/src/injected/client.js:11362:51)
    at Object._Future__propagateToListeners (http://localhost:53322/dwds/src/injected/client.js:3914:93)
    at _Future._complete$1 (http://localhost:53322/dwds/src/injected/client.js:11186:11)
    at Object._cancelAndValue (http://localhost:53322/dwds/src/injected/client.js:4069:16)
    at Stream_first_closure0.call$1 (http://localhost:53322/dwds/src/injected/client.js:11454:9)
    at _EventStreamSubscription_onData_closure.call$1 (http://localhost:53322/dwds/src/injected/client.js:17309:30)
    at StaticClosure._rootRunUnary [as call$2$5](http://localhost:53322/dwds/src/injected/client.js:4136:16)
    at _CustomZone.runUnary$2$2 (http://localhost:53322/dwds/src/injected/client.js:12301:39)
    at _CustomZone.runUnaryGuarded$1$2 (http://localhost:53322/dwds/src/injected/client.js:12233:14)
    at _CustomZone_bindUnaryCallbackGuarded_closure.call$1 (http://localhost:53322/dwds/src/injected/client.js:12436:25)
    at invokeClosure (http://localhost:53322/dwds/src/injected/client.js:1204:26)
    at EventSource.<anonymous> (http://localhost:53322/dwds/src/injected/client.js:1223:18)

这是因为Chrome浏览器新版本API更改引起的,不再公开window.performance.memory的构造函数(而是使用Object的构造函数),hack评估结果为true(window.performance.memory 是 html.MemoryInfo)。
解决方法:
在AngularDart项目的web目录中的index.html文件中添加如下脚本:

<script>
    if (typeof window.MemoryInfo == "undefined") {
      if (typeof window.performance.memory != "undefined") {
        window.MemoryInfo = function () {};
        window.MemoryInfo.prototype = window.performance.memory.__proto__;
      }
    }
</script>
相关文章
|
存储 人工智能 监控
大牛直播SDK在四足机器人和无人机巡检中的创新应用方案
在工业4.0和智能化浪潮下,传统巡检方式正经历深刻变革。四足机器人与无人机凭借灵活机动性和高效巡检能力崭露头角,而大牛直播SDK则赋予其实时直播与智能互动功能。本文介绍大牛直播SDK的核心优势、在四足机器人和无人机巡检中的应用方案,以及技术实现要点和未来展望,展示智能巡检的广阔前景。
643 6
|
前端开发 安全 开发工具
【11】flutter进行了聊天页面的开发-增加了即时通讯聊天的整体页面和组件-切换-朋友-陌生人-vip开通详细页面-即时通讯sdk准备-直播sdk准备-即时通讯有无UI集成的区别介绍-开发完整的社交APP-前端客户端开发+数据联调|以优雅草商业项目为例做开发-flutter开发-全流程-商业应用级实战开发-优雅草Alex
【11】flutter进行了聊天页面的开发-增加了即时通讯聊天的整体页面和组件-切换-朋友-陌生人-vip开通详细页面-即时通讯sdk准备-直播sdk准备-即时通讯有无UI集成的区别介绍-开发完整的社交APP-前端客户端开发+数据联调|以优雅草商业项目为例做开发-flutter开发-全流程-商业应用级实战开发-优雅草Alex
1367 90
【11】flutter进行了聊天页面的开发-增加了即时通讯聊天的整体页面和组件-切换-朋友-陌生人-vip开通详细页面-即时通讯sdk准备-直播sdk准备-即时通讯有无UI集成的区别介绍-开发完整的社交APP-前端客户端开发+数据联调|以优雅草商业项目为例做开发-flutter开发-全流程-商业应用级实战开发-优雅草Alex
|
监控 开发工具 Android开发
ARMS 用户体验监控正式发布原生鸿蒙应用 SDK
阿里云 ARMS 用户体验监控(RUM)推出了针对原生鸿蒙应用的 SDK。SDK 使用 ArkTS 语言开发,支持页面采集、资源加载采集、异常采集及自定义采集等功能,能够全面监控鸿蒙应用的表现。集成简单,只需几步即可将 SDK 接入项目中,为鸿蒙应用的开发者提供了强有力的支持。
1150 137
|
前端开发 Java Shell
【08】flutter完成屏幕适配-重建Android,增加GetX路由,屏幕适配,基础导航栏-多版本SDK以及gradle造成的关于fvm的使用(flutter version manage)-卓伊凡换人优雅草Alex-开发完整的社交APP-前端客户端开发+数据联调|以优雅草商业项目为例做开发-flutter开发-全流程-商业应用级实战开发-优雅草Alex
【08】flutter完成屏幕适配-重建Android,增加GetX路由,屏幕适配,基础导航栏-多版本SDK以及gradle造成的关于fvm的使用(flutter version manage)-卓伊凡换人优雅草Alex-开发完整的社交APP-前端客户端开发+数据联调|以优雅草商业项目为例做开发-flutter开发-全流程-商业应用级实战开发-优雅草Alex
1239 20
【08】flutter完成屏幕适配-重建Android,增加GetX路由,屏幕适配,基础导航栏-多版本SDK以及gradle造成的关于fvm的使用(flutter version manage)-卓伊凡换人优雅草Alex-开发完整的社交APP-前端客户端开发+数据联调|以优雅草商业项目为例做开发-flutter开发-全流程-商业应用级实战开发-优雅草Alex
|
开发工具 Android开发
解决Android运行出现NDK at /Library/Android/sdk/ndk-bundle did not have a source.properties file
解决Android运行出现NDK at /Library/Android/sdk/ndk-bundle did not have a source.properties file
1910 4
解决Android运行出现NDK at /Library/Android/sdk/ndk-bundle did not have a source.properties file
|
存储 人工智能 Java
2024创建boot时 项目SDK11不支持所选的版本Java21 请选择较低版本的java 解决方案
2024创建boot时 项目SDK11不支持所选的版本Java21 请选择较低版本的java 解决方案
771 2
|
Linux 调度 开发工具
云桌面系统镜像文件快速分发方案分享SDK
为了解决云桌面环境下批量升级系统镜像的效率问题,传统的1对多FTP/HTTP方式因服务器带宽限制导致传输慢。一种基于优化的Bittorrent协议的P2P解决方案被提出,利用P2P技术将文件切块并让终端互相分享,提高下载速度,尤其适合大文件如256GB分区镜像的分发。通过自定义IO接口、跳过校验、超大分块、多分块支持及局域网自建Tracker等功能,实现更快的传输和镜像更新,适用于系统镜像、游戏更新等领域。该方案已广泛应用于各行业,可根据不同场景定制优化。
681 1
|
开发工具 数据安全/隐私保护 Python
【Azure 环境】通过Python SDK收集所有订阅简略信息,例如订阅id 名称, 资源组及组内资源信息等,如何给Python应用赋予相应的权限才能获取到信息呢?
【Azure 环境】通过Python SDK收集所有订阅简略信息,例如订阅id 名称, 资源组及组内资源信息等,如何给Python应用赋予相应的权限才能获取到信息呢?
332 0
|
存储 Java 开发工具
【Azure Developer】VS Code运行Java 版Azure Storage SDK操作Blob (新建Container, 上传Blob文件,下载及清理)
【Azure Developer】VS Code运行Java 版Azure Storage SDK操作Blob (新建Container, 上传Blob文件,下载及清理)
394 0