Angular zone.js - zone-evergreen.js error : t.getElementsByTagName is not a function

Angular zone.js - zone-evergreen.js error : t.getElementsByTagName is not a function

我在 Angular 11 上有一个应用程序刚刚开始在所有浏览器、所有环境(本地/暂存/生产环境)上同时出现错误(大约一个小时前,没有任何更新或任何东西) :

Uncaught TypeError: t.getElementsByTagName is not a function
    at computeStackTrace.js:338
    at Array.forEach (<anonymous>)
    at computeStackTrace.js:338
    at Array.forEach (<anonymous>)
    at MutationObserver.<anonymous> (computeStackTrace.js:338)
    at l.invoke (polyfills.98c82c2662d9589ab04d.js:formatted:278)
    at a.runGuarded (polyfills.98c82c2662d9589ab04d.js:formatted:119)
    at MutationObserver.<anonymous> (polyfills.98c82c2662d9589ab04d.js:formatted:98)

我们的 package.json 依赖项:

    "dependencies": {
        "@angular-material-components/color-picker": "^5.0.0",
        "@angular-material-components/datetime-picker": "^5.0.0",
        "@angular/animations": "^11.2.14",
        "@angular/cdk": "^11.2.13",
        "@angular/common": "^11.2.14",
        "@angular/compiler": "^11.2.14",
        "@angular/core": "^11.2.14",
        "@angular/forms": "^11.2.14",
        "@angular/material": "^11.2.13",
        "@angular/platform-browser": "^11.2.14",
        "@angular/platform-browser-dynamic": "^11.2.14",
        "@angular/router": "^11.2.14",
        "@ngx-translate/core": "^13.0.0",
        "@ngx-translate/http-loader": "^6.0.0",
        "@sentry/angular": "^6.7.1",
        "@sentry/integrations": "^6.7.2",
        "@sentry/tracing": "^6.7.1",
        "@swimlane/ngx-charts": "^16.0.0",
        "amplitude-js": "^7.3.1",
        "bootstrap": "^4.5.3",
        "flag-icon-css": "^3.5.0",
        "http-status-codes": "^1.4.0",
        "jspdf": "^2.3.1",
        "jwt-decode": "^2.2.0",
        "libphonenumber-js": "^1.9.36",
        "lodash": "^4.17.21",
        "messageformat": "^2.3.0",
        "ng2-pdfjs-viewer": "^6.0.1",
        "ngx-kjua": "^1.12.3",
        "ngx-mat-select-search": "^3.3.0",
        "ngx-translate-messageformat-compiler": "^4.9.0",
        "rxjs": "^6.6.3",
        "slugify": "^1.5.3",
        "tslib": "^2.0.0",
        "zone.js": "~0.10.2"
    },

我们尝试了几种方法(甚至在本地升级到 Angular 12,错误仍然存​​在),但没有任何效果:(

有人看过类似的东西吗?

已解决! 2 小时后,我们终于找到了罪魁祸首:在 index.html 中导入的 Hubspot (CRM) 脚本 ...(显然它破坏了 HTML 结构)

我们删除了 <script> 标签,一切立即恢复正常......把它留在这里以防有一天有人遇到同样的问题!

该问题现已根据 HubSpot 得到修复:https://community.hubspot.com/t5/APIs-Integrations/t-getElementsByTagName-is-not-a-function-from-https-js/m-p/534903

我的项目面临同样的问题,我们最后一次在生产中看到它是在 2021 年 12 月 1 日 1:10pm 美国东部时间。