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>
相关文章
|
4月前
|
Web App开发 存储 Linux
Linux(33)Rockchip RK3568 Ubuntu22.04上通过SSH运行Qt程序和关闭Chrome的密钥提示
Linux(33)Rockchip RK3568 Ubuntu22.04上通过SSH运行Qt程序和关闭Chrome的密钥提示
333 0
|
4月前
|
JSON Serverless API
Serverless 应用引擎常见问题之通过SDK修改调度器报错如何解决
Serverless 应用引擎(Serverless Application Engine, SAE)是一种完全托管的应用平台,它允许开发者无需管理服务器即可构建和部署应用。以下是Serverless 应用引擎使用过程中的一些常见问题及其答案的汇总:
|
4月前
|
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://的原因及解决方案
231 0
控制台出现报错DevTools failed to load source map: Could not load content for chrome-extension://的原因及解决方案
|
1月前
|
Dart 开发工具 Android开发
Android Studio导入Flutter项目提示Dart SDK is not configured
Android Studio导入Flutter项目提示Dart SDK is not configured
70 4
|
27天前
|
开发工具 数据安全/隐私保护 Python
【Azure 环境】通过Python SDK收集所有订阅简略信息,例如订阅id 名称, 资源组及组内资源信息等,如何给Python应用赋予相应的权限才能获取到信息呢?
【Azure 环境】通过Python SDK收集所有订阅简略信息,例如订阅id 名称, 资源组及组内资源信息等,如何给Python应用赋予相应的权限才能获取到信息呢?
|
2月前
|
NoSQL 开发工具 数据库
开发与运维测试问题之应用启动报 Can not load this fake sdk class 的异常如何解决
开发与运维测试问题之应用启动报 Can not load this fake sdk class 的异常如何解决
|
3月前
|
编解码 运维 Serverless
Serverless 应用引擎产品使用合集之如何使用SDK
阿里云Serverless 应用引擎(SAE)提供了完整的微服务应用生命周期管理能力,包括应用部署、服务治理、开发运维、资源管理等功能,并通过扩展功能支持多环境管理、API Gateway、事件驱动等高级应用场景,帮助企业快速构建、部署、运维和扩展微服务架构,实现Serverless化的应用部署与运维模式。以下是对SAE产品使用合集的概述,包括应用管理、服务治理、开发运维、资源管理等方面。
|
2月前
|
Web App开发 前端开发
canvas保存图片时,谷歌浏览器Chrome报错【解决方案】Not allowed to navigate top frame to data URL
canvas保存图片时,谷歌浏览器Chrome报错【解决方案】Not allowed to navigate top frame to data URL
85 0
|
3月前
|
运维 Serverless API
Serverless 应用引擎产品使用合集之如何使用PHP SDK调用函数并在请求体(body)中传递字符串
阿里云Serverless 应用引擎(SAE)提供了完整的微服务应用生命周期管理能力,包括应用部署、服务治理、开发运维、资源管理等功能,并通过扩展功能支持多环境管理、API Gateway、事件驱动等高级应用场景,帮助企业快速构建、部署、运维和扩展微服务架构,实现Serverless化的应用部署与运维模式。以下是对SAE产品使用合集的概述,包括应用管理、服务治理、开发运维、资源管理等方面。
|
4月前
|
弹性计算 运维 Serverless
Serverless 应用引擎产品使用之在阿里函数计算中,使用阿里云API或SDK从函数计算调用ECS实例的服务如何解决
阿里云Serverless 应用引擎(SAE)提供了完整的微服务应用生命周期管理能力,包括应用部署、服务治理、开发运维、资源管理等功能,并通过扩展功能支持多环境管理、API Gateway、事件驱动等高级应用场景,帮助企业快速构建、部署、运维和扩展微服务架构,实现Serverless化的应用部署与运维模式。以下是对SAE产品使用合集的概述,包括应用管理、服务治理、开发运维、资源管理等方面。

热门文章

最新文章