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>
相关文章
|
3月前
|
JavaScript 前端开发 开发工具
【Azure Developer】使用JavaScript通过SDK进行monitor-query的client认证报错问题
AADSTS90002: Tenant 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' not found. Check to make sure you have the correct tenant ID and are signing into the correct cloud. Check with your subscription administrator, this may happen if there are no active subscriptions for the tenant.
|
5月前
|
开发工具 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
214 4
解决Android运行出现NDK at /Library/Android/sdk/ndk-bundle did not have a source.properties file
|
5月前
|
Dart 开发工具 Android开发
Android Studio导入Flutter项目提示Dart SDK is not configured
Android Studio导入Flutter项目提示Dart SDK is not configured
507 4
|
5月前
|
开发工具 图形学 Android开发
Unity与安卓丨unity报错:SDK Tools version 0.0 < 26.1.1
Unity与安卓丨unity报错:SDK Tools version 0.0 < 26.1.1
|
6月前
|
Serverless 语音技术 开发工具
函数计算操作报错合集之怎么何集成nls tts python sdk
在使用函数计算服务(如阿里云函数计算)时,用户可能会遇到多种错误场景。以下是一些常见的操作报错及其可能的原因和解决方法,包括但不限于:1. 函数部署失败、2. 函数执行超时、3. 资源不足错误、4. 权限与访问错误、5. 依赖问题、6. 网络配置错误、7. 触发器配置错误、8. 日志与监控问题。
|
6月前
|
机器学习/深度学习 Serverless API
函数计算操作报错合集之调用SDK报错 "InvalidAction.Mismatch",该怎么办
在使用函数计算服务(如阿里云函数计算)时,用户可能会遇到多种错误场景。以下是一些常见的操作报错及其可能的原因和解决方法,包括但不限于:1. 函数部署失败、2. 函数执行超时、3. 资源不足错误、4. 权限与访问错误、5. 依赖问题、6. 网络配置错误、7. 触发器配置错误、8. 日志与监控问题。
|
5月前
|
开发工具 iOS开发 容器
【Azure Blob】关闭Blob 匿名访问,iOS Objective-C SDK连接Storage Account报错
【Azure Blob】关闭Blob 匿名访问,iOS Objective-C SDK连接Storage Account报错
|
5月前
|
存储 Java 开发工具
【Azure Developer】VS Code运行Java 版Azure Storage SDK操作Blob (新建Container, 上传Blob文件,下载及清理)
【Azure Developer】VS Code运行Java 版Azure Storage SDK操作Blob (新建Container, 上传Blob文件,下载及清理)
|
6月前
|
开发工具 iOS开发 容器
【Azure Blob】关闭Blob 匿名访问,iOS Objective-C SDK连接Storage Account报错
iOS Objective-C 应用连接Azure Storage时,若不关闭账号的匿名访问,程序能正常运行。但关闭匿名访问后,上传到容器时会出现错误:“Public access is not permitted”。解决方法是将创建容器时的公共访问类型从`AZSContainerPublicAccessTypeContainer`改为`AZSContainerPublicAccessTypeOff`,以确保通过授权请求访问。
【Azure Blob】关闭Blob 匿名访问,iOS Objective-C SDK连接Storage Account报错
|
6月前
|
存储 开发工具
通用快照方案问题之快照SDK的安装如何解决
通用快照方案问题之快照SDK的安装如何解决
59 0