简体   繁体   English

Angular 更新到最新 v13 后无法设置属性 ɵfac

[英]Cannot set property ɵfac after Angular update to latest v13

I updated the project via ng update from CLI@13.0.0 and Core@13.2.5 to the latest v13 minor releases (CLI@13.3.8 / Core@13.3.11 ).我通过 ng update 从CLI@13.0.0Core@13.2.5将项目更新到最新的 v13 次要版本(CLI@13.3.8 / Core@13.3.11 )。

Since the update I got following error in the web console:自更新以来,我在 Web 控制台中收到以下错误:

table.component.ts:231 Uncaught TypeError: Cannot set property ɵfac of class BaseComponent {
constructor(injector) {
    this.store = injector.get(_ngxs_store__...<omitted>...}
 which has only a getter
at 7857 (table.component.ts:231:2)
at __webpack_require__ (bootstrap:19:1)
at 32552 (message.service.ts:18:31)
at __webpack_require__ (bootstrap:19:1)
at 21658 (auth.service.ts:6:21)
at __webpack_require__ (bootstrap:19:1)
at 197 (dialog.service.ts:31:32)
at __webpack_require__ (bootstrap:19:1)
at 47819 (route-not-found.component.html:13:5)
at __webpack_require__ (bootstrap:19:1)
at 98698 (menu-routing.module.ts:86:25)
at __webpack_require__ (bootstrap:19:1)
at 13785 (menu.module.ts:12:68)
at __webpack_require__ (bootstrap:19:1)
at 60796 (app.component.ts:30:26)

The component itself is an abstract BaseComponent used to be extended, the DI is managed by passing the Injector to the super constructor.组件本身是一个用于扩展的抽象 BaseComponent,DI 是通过将 Injector 传递给超级构造函数来管理的。

I already researched and came across Angular 9 production error: Cannot set property ɵfac of (abstract) class MyFilter { } which has only a getter我已经研究并遇到了Angular 9 生产错误:Cannot set property ɵfac of (abstract) class MyFilter { } which has only a getter

Removing the @Component Tag removes the error but why shouldn't it work anymore?删除@Component标记会删除错误,但为什么它不再起作用了? Furthermore after removing the tag another error appears in the console (I'm using NGXS@3.7.3 and note that the NGX-Store worked before, no code change in between)此外,删除标签后,控制台中会出现另一个错误(我使用的是NGXS@3.7.3并注意 NGX-Store 之前工作过,两者之间没有代码更改)

core.mjs:6494 ERROR Error: You have forgotten to import the NGXS module!
at throwSelectFactoryNotConnectedError (ngxs-store.js:73:1) [angular]
at createSelectObservableIvy (ngxs-store.js:3844:1) [angular]
at createSelectObservable (ngxs-store.js:3800:1) [angular]
at dev/vendor.js:86124:36 [angular]
at doInnerSub (mergeInternals.js:19:18) [angular]
at outerNext (mergeInternals.js:14:1) [angular]
at OperatorSubscriber._next (OperatorSubscriber.js:13:1) [angular]
at OperatorSubscriber.next (Subscriber.js:31:1) [angular]
at ReplaySubject._subscribe (ReplaySubject.js:31:1) [angular]
at ReplaySubject._trySubscribe (Observable.js:37:1) [angular]
at ReplaySubject._trySubscribe (Subject.js:74:1) [angular]
at dev/vendor.js:98953:30 [angular]
at errorContext (errorContext.js:19:1) [angular]
at ReplaySubject.subscribe (Observable.js:22:21) [angular]

Anyone got an idea?有人有想法吗? I'm stuck on this.我坚持这一点。 Thank you!谢谢!

I found a solution:我找到了一个解决方案:

the @Select Tags from the ngxs/store seem to be conflicting. ngxs/store 中的 @Select 标签似乎有冲突。 When replacing them with select functions from the store the BaseComponents work fine!当用商店中的选择功能替换它们时,BaseComponents 工作正常!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 类型错误:无法重新定义属性:angular 中的 ɵfac - TypeError: Cannot redefine property: ɵfac in angular 找不到模块“@angular/cdk/dialog”- Angular 将 v13 升级到 v14 问题 - Cannot find module '@angular/cdk/dialog' - Angular upgrade v13 to v14 issue Angular 9 生产错误:无法设置(抽象)类 MyFilter { } 的属性 ɵfac,它只有一个 getter - Angular 9 production error: Cannot set property ɵfac of (abstract) class MyFilter { } which has only a getter 将 Angular v12 升级到 v13 后未捕获 TypeError - Uncaught TypeError after upgrading Angular v12 to v13 升级到 Angular v13 后,每次更改都会修改附加缓存文件 - After upgrade to Angular v13, Additional cache files modified on each change Angular CLI v13 - 无法运行“ng”命令 - Angular CLI v13 - Can not run "ng" commands Angular v13 带 nx 测试的玩笑 - 语法错误:无法在 Runtime.createScriptFromCode 的模块外使用导入语句 - Angular v13 Jest with nx test - SyntaxError: Cannot use import statement outside a module at Runtime.createScriptFromCode 使用 webdesigner 将 silverlight 的 Active Reports v7 迁移到最新的 v13 - Migrate Active Reports v7 for silverlight to latest v13 with webdesigner Angular 使用@angular-builders/custom-webpack 将 v13 迁移到 v14 - Angular migration v13 to v14 using @angular-builders/custom-webpack 升级 angular v12 到 v13 时出现找不到模块错误 - Getting Module not found error when upgrade angular v12 to v13
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM