Angular 13 -main.js:1 typeError:无法读取未定义的属性(读取' deps')

发布于 2025-01-28 14:08:09 字数 4158 浏览 4 评论 0原文

从Angular 11升级到13是完美无瑕的。 该应用程序使用了几个在外部构建的自定义库。在升级之前,我手动在应用程序内部创建了这些组件/服务/模型,并且所有内容都可以运行并汇总了。但是,此错误将在安装.tgz包装版本的应用程序中导出事物后仍然存在:

main.js:1 TypeError: Cannot read properties of undefined (reading 'deps')
    at VV (main.js:1:65360)
    at ZE (main.js:1:65365)
    at PV (main.js:1:63675)
    at RV.processProvider (main.js:1:63685)
    at main.js:1:63486
    at main.js:1:32945
    at Array.forEach (<anonymous>)
    at qa (main.js:1:32909)
    at RV.processInjectorType (main.js:1:63473)
    at main.js:1:63153

与此同时,如果我尝试ng构建-Watch < /code> < /code>库和从 /dist文件夹导入对象。安装包装版本.tgz不会,而所有内容都没有错误。

{
    "name": "app-ui",
    "version": "0.0.0",
    "scripts": {
        "ng": "ng",
        "start": "ng serve --port 1234 --verbose",
        "build": "ng build --prod",
        "test": "ng test",
        "lint": "ng lint",
        "e2e": "ng e2e",
        "playground": "angular-playground"
    },
    "private": true,
    "devDependencies": {
        "@angular-devkit/build-angular": "^13.3.4",
        "@angular/cli": "^13.3.4",
        "@angular/compiler-cli": "^13.3.5",
        "@types/angular": "1.8.4",
        "@types/echarts": "^4.9.15",
        "@types/jasmine": "^4.0.3",
        "@types/jasminewd2": "~2.0.10",
        "@types/jquery": "^3.5.6",
        "@types/moment": "^2.13.0",
        "@types/node": "^17.0.31",
        "@types/slickgrid": "^2.1.32",
        "angular-playground": "^9.0.1",
        "codelyzer": "^6.0.2",
        "jasmine-core": "~4.1.0",
        "jasmine-spec-reporter": "~7.0.0",
        "karma": "^6.3.19",
        "karma-chrome-launcher": "~3.1.1",
        "karma-coverage-istanbul-reporter": "~3.0.2",
        "karma-jasmine": "^5.0.0",
        "karma-jasmine-html-reporter": "~1.7.0",
        "ng-packagr": "^13.0.0",
        "protractor": "~7.0.0",
        "resize-observer-polyfill": "^1.5.1",
        "ts-node": "~10.7.0",
        "tslint": "~6.1.3",
        "typescript": "^4.6.4"
    },
    "dependencies": {
        "@angular/animations": "^13.3.5",
        "@angular/cdk": "^13.3.5",
        "@angular/common": "^13.3.5",
        "@angular/compiler": "^13.3.5",
        "@angular/core": "^13.3.5",
        "@angular/forms": "^13.3.5",
        "@angular/material": "^13.3.5",
        "@angular/platform-browser": "^13.3.5",
        "@angular/platform-browser-dynamic": "^13.3.5",
        "@angular/router": "^13.3.5",
        "@egjs/hammerjs": "^2.0.17",
        "@custom/services": "file:../../custom/angular-libraries/projects/custom-services/custom-services-2.0.0.tgz",
        "@ngx-loading-bar/core": "^6.0.2",
        "@ngx-loading-bar/http-client": "^6.0.2",
        "@ngx-translate/core": "^14.0.0",
        "@ngx-translate/http-loader": "^7.0.0",
        "@popperjs/core": "^2.11.5",
        "@slickgrid-universal/common": "^1.2.6",
        "angular-slickgrid": "^4.1.4",
        "bootstrap": "3.4.1",
        "classlist.js": "^1.1.20150312",
        "core-js": "^3.22.4",
        "custom-event-polyfill": "^1.0.7",
        "echarts": "^5.3.2",
        "flatpickr": "^4.6.13",
        "font-awesome": "^4.7.0",
        "jquery": "3.6.0",
        "jquery-ui-dist": "^1.13.1",
        "keycharm": "^0.4.0",
        "moment": "^2.29.3",
        "multiple-select-modified": "^1.3.17",
        "ngx-echarts": "^8.0.1",
        "ngx-loading-bar": "0.0.9",
        "normalize-scss": "^7.0.1",
        "normalize.css": "^8.0.1",
        "rxjs": "~7.5.0",
        "tslib": "^2.4.0",
        "web-animations-js": "^2.3.2",
        "zone.js": "~0.11.4"
    }
}
  • 在Angular 11上,一切都很好,
  • 我的任何文件中都没有关键字“ deps”。
  • 这些服务包括 authservice Interceptor api (仅包括标准的HTTP客户端方法)。
  • 是的,我尝试了常春藤的部分,非部分和常春藤错误。 是的
  • ,我尝试删除node_modules。相同的。是的,在node_modules中正确安装/导入了所有内容...如果我搞砸了,我会遇到类型错误。
  • 是的,我尝试了:“ ModuleReSolution”:“ Node”“ target”:“ ES2020”“ lib”:[“ DOM”,“ ES2020” ]“模块”:“ es2020”“ types”:[“ jasmine”,“ node”]在所有适当的文件中,就像其他线程一样在Angular升级期间说“无法阅读未定义的属性”时提到,但没有成功。

Upgrading from Angular 11 to 13 was flawless.
The application used several custom libraries that were built externally. Prior to the upgrade, I manually created those components/services/models inside the app and everything ran and compiled fine. However this error persists after exporting the things back out of the app installing the .tgz packed version:

main.js:1 TypeError: Cannot read properties of undefined (reading 'deps')
    at VV (main.js:1:65360)
    at ZE (main.js:1:65365)
    at PV (main.js:1:63675)
    at RV.processProvider (main.js:1:63685)
    at main.js:1:63486
    at main.js:1:32945
    at Array.forEach (<anonymous>)
    at qa (main.js:1:32909)
    at RV.processInjectorType (main.js:1:63473)
    at main.js:1:63153

Meanwhile, if I try to ng build --watch the library and import objects from the /dist folder everything works. Installing packed version .tgz doesn't, while everything compiles without errors.

{
    "name": "app-ui",
    "version": "0.0.0",
    "scripts": {
        "ng": "ng",
        "start": "ng serve --port 1234 --verbose",
        "build": "ng build --prod",
        "test": "ng test",
        "lint": "ng lint",
        "e2e": "ng e2e",
        "playground": "angular-playground"
    },
    "private": true,
    "devDependencies": {
        "@angular-devkit/build-angular": "^13.3.4",
        "@angular/cli": "^13.3.4",
        "@angular/compiler-cli": "^13.3.5",
        "@types/angular": "1.8.4",
        "@types/echarts": "^4.9.15",
        "@types/jasmine": "^4.0.3",
        "@types/jasminewd2": "~2.0.10",
        "@types/jquery": "^3.5.6",
        "@types/moment": "^2.13.0",
        "@types/node": "^17.0.31",
        "@types/slickgrid": "^2.1.32",
        "angular-playground": "^9.0.1",
        "codelyzer": "^6.0.2",
        "jasmine-core": "~4.1.0",
        "jasmine-spec-reporter": "~7.0.0",
        "karma": "^6.3.19",
        "karma-chrome-launcher": "~3.1.1",
        "karma-coverage-istanbul-reporter": "~3.0.2",
        "karma-jasmine": "^5.0.0",
        "karma-jasmine-html-reporter": "~1.7.0",
        "ng-packagr": "^13.0.0",
        "protractor": "~7.0.0",
        "resize-observer-polyfill": "^1.5.1",
        "ts-node": "~10.7.0",
        "tslint": "~6.1.3",
        "typescript": "^4.6.4"
    },
    "dependencies": {
        "@angular/animations": "^13.3.5",
        "@angular/cdk": "^13.3.5",
        "@angular/common": "^13.3.5",
        "@angular/compiler": "^13.3.5",
        "@angular/core": "^13.3.5",
        "@angular/forms": "^13.3.5",
        "@angular/material": "^13.3.5",
        "@angular/platform-browser": "^13.3.5",
        "@angular/platform-browser-dynamic": "^13.3.5",
        "@angular/router": "^13.3.5",
        "@egjs/hammerjs": "^2.0.17",
        "@custom/services": "file:../../custom/angular-libraries/projects/custom-services/custom-services-2.0.0.tgz",
        "@ngx-loading-bar/core": "^6.0.2",
        "@ngx-loading-bar/http-client": "^6.0.2",
        "@ngx-translate/core": "^14.0.0",
        "@ngx-translate/http-loader": "^7.0.0",
        "@popperjs/core": "^2.11.5",
        "@slickgrid-universal/common": "^1.2.6",
        "angular-slickgrid": "^4.1.4",
        "bootstrap": "3.4.1",
        "classlist.js": "^1.1.20150312",
        "core-js": "^3.22.4",
        "custom-event-polyfill": "^1.0.7",
        "echarts": "^5.3.2",
        "flatpickr": "^4.6.13",
        "font-awesome": "^4.7.0",
        "jquery": "3.6.0",
        "jquery-ui-dist": "^1.13.1",
        "keycharm": "^0.4.0",
        "moment": "^2.29.3",
        "multiple-select-modified": "^1.3.17",
        "ngx-echarts": "^8.0.1",
        "ngx-loading-bar": "0.0.9",
        "normalize-scss": "^7.0.1",
        "normalize.css": "^8.0.1",
        "rxjs": "~7.5.0",
        "tslib": "^2.4.0",
        "web-animations-js": "^2.3.2",
        "zone.js": "~0.11.4"
    }
}
  • Everything was working fine on Angular 11
  • There's no keyword 'deps' in any of my files.
  • The services include AuthService, Interceptor and Api (which includes just standard HTTP client methods).
  • Yes, I tried Ivy partial, non partial and ivy false. Same
  • Yes, I tried deleting node_modules. Same. And yes everything is being installed/imported correctly in node_modules... I get type errors if I mess something up.
  • Yes, I tried: "moduleResolution": "Node", "target": "es2020", "lib": ["dom", "es2020"], "module": "es2020", "types":["jasmine", "node"] in all the appropriate files as other threads have mentioned when dealing with "Cannot read properties of undefined...." during Angular upgrade but no success.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文