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>
相关文章
|
Web App开发 存储 Linux
Linux(33)Rockchip RK3568 Ubuntu22.04上通过SSH运行Qt程序和关闭Chrome的密钥提示
Linux(33)Rockchip RK3568 Ubuntu22.04上通过SSH运行Qt程序和关闭Chrome的密钥提示
1737 0
|
6月前
|
Web App开发 存储 数据处理
Chrome 下载大文件报错!用 Streamsaver.js 完美填坑
本文探讨了Chrome下载大文件报“网络错误”的原因及解决方案。由于Chrome对Blob数据有大小限制,导致大文件下载失败。通过将responseType改为ArrayBuffer可临时解决1-2G文件问题,但超3G仍会崩溃。最佳方案是使用Streamsaver.js实现流式下载,边接收边保存,避免内存溢出,完美支持超大文件下载。
3986 3
|
Web App开发 前端开发 JavaScript
控制台出现报错DevTools failed to load source map: Could not load content for chrome-extension://的原因及解决方案
控制台出现报错DevTools failed to load source map: Could not load content for chrome-extension://的原因及解决方案
1187 0
控制台出现报错DevTools failed to load source map: Could not load content for chrome-extension://的原因及解决方案
|
开发工具 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
1586 4
解决Android运行出现NDK at /Library/Android/sdk/ndk-bundle did not have a source.properties file
|
Dart 开发工具 Android开发
Android Studio导入Flutter项目提示Dart SDK is not configured
Android Studio导入Flutter项目提示Dart SDK is not configured
2112 4
|
存储 人工智能 Java
2024创建boot时 项目SDK11不支持所选的版本Java21 请选择较低版本的java 解决方案
2024创建boot时 项目SDK11不支持所选的版本Java21 请选择较低版本的java 解决方案
534 2
|
存储 Java 开发工具
【Azure Developer】VS Code运行Java 版Azure Storage SDK操作Blob (新建Container, 上传Blob文件,下载及清理)
【Azure Developer】VS Code运行Java 版Azure Storage SDK操作Blob (新建Container, 上传Blob文件,下载及清理)
258 0
|
DataWorks 安全 API
DataWorks产品使用合集之有api或者是sdk可以获取到 dataworks 的任务运行的结果吗
DataWorks作为一站式的数据开发与治理平台,提供了从数据采集、清洗、开发、调度、服务化、质量监控到安全管理的全套解决方案,帮助企业构建高效、规范、安全的大数据处理体系。以下是对DataWorks产品使用合集的概述,涵盖数据处理的各个环节。
162 1
|
Web App开发 Java Serverless
Serverless 应用引擎操作报错合集之阿里函数计算中,使用自定义运行时部署程序时,发现Chrome层已经建立但运行程序仍然缺失如何解决
Serverless 应用引擎(SAE)是阿里云提供的Serverless PaaS平台,支持Spring Cloud、Dubbo、HSF等主流微服务框架,简化应用的部署、运维和弹性伸缩。在使用SAE过程中,可能会遇到各种操作报错。以下是一些常见的报错情况及其可能的原因和解决方法。
307 1
下一篇
开通oss服务