TypeError:不能在angular中重新定义property:


core.js:27478 Uncaught TypeError: Cannot redefine property: ɵfac
at Function.defineProperty (<anonymous>)
at addDirectiveFactoryDef (core.js:27478:1)
at compileComponent (core.js:27361:1)
at ɵ3$1 (core.js:27674:93)
at TypeDecorator (core.js:3758:1)
at __decorate (tslib.es6.js:58:53)
at Module.ENgC (collection-list-section-form.component.ts:46:48)
at __webpack_require__ (bootstrap:84:1)
at Module.GCp2 (sub-action-file-upload.component.ts:9:42)
at __webpack_require__ (bootstrap:84:1)

有人知道如何解决这个问题吗?我的包。json是

{
"name": "frontend-app",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build --prod",
"build-production": "ng build --prod --configuration production",
"build-staging": "ng build --prod --configuration staging",
"build-develop": "ng build --prod --configuration develop",
"test": "ng test --code-coverage",
"lint": "ng lint --ts-config tsconfig.json --tslint-config tslint.json",
"e2e": "ng e2e",
"sonar": "sonar-scanner"
},
"private": true,
"dependencies": {
"@angular-material-components/datetime-picker": "^6.0.2",
"@angular-material-components/moment-adapter": "^6.0.0",
"@angular/animations": "~11.2.4",
"@angular/cdk": "~11.2.3",
"@angular/common": "~11.2.4",
"@angular/core": "~11.2.4",
"@angular/forms": "~11.2.4",
"@angular/localize": "^11.2.4",
"@angular/material": "^11.2.3",
"@angular/platform-browser": "~11.2.4",
"@angular/platform-browser-dynamic": "~11.2.4",
"@angular/router": "~11.2.4",
"@material-extended/mde": "^3.0.3",
"@ngx-translate/core": "^13.0.0",
"@ngx-translate/http-loader": "^6.0.0",
"@ngxs/storage-plugin": "^3.7.1",
"@ngxs/store": "^3.7.1",
"@swimlane/ngx-datatable": "^19.0.0",
"angular-google-tag-manager": "1.4.2",
"angularx-social-login": "^3.5.7",
"bootstrap": "^4.4.1",
"hammerjs": "^2.0.8",
"i": "^0.3.6",
"ngx-bootstrap": "^5.3.2",
"ngx-captcha": "^10.0.0",
"ngx-color-picker": "^8.2.0",
"ngx-csv-parser": "0.0.7",
"ngx-google-places-autocomplete": "^2.0.5",
"ngx-infinite-scroll": "^8.0.0",
"ngx-quill": "13.2.0",
"ngx-youtube-player": "^12.0.1",
"ngxs-reset-plugin": "^1.3.1",
"quill": "^1.3.6",
"rxjs": "~6.6.6",
"tslib": "^2.0.0",
"zone.js": "~0.10.3"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.1102.3",
"@angular/cli": "~11.2.3",
"@angular/compiler": "^11.2.4",
"@angular/compiler-cli": "^11.2.0",
"@angular/language-service": "~11.2.4",
"@ngxs/devtools-plugin": "^3.7.1",
"@schematics/angular": "^12.2.9",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^14.14.31",
"codelyzer": "^6.0.1",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~6.1.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage": "^2.0.3",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.5.4",
"protractor": "~7.0.0",
"sonar-scanner": "^3.1.0",
"ts-node": "~7.0.0",
"tslint": "~6.1.3",
"typescript": "~4.0.7"
}
}

你有

"@ngxs/storage-plugin": "^3.7.1",
"@ngxs/store": "^3.7.1",

所以你将安装NGXS的最新版本(你可以检查NPM list——depth=1))

我已经解决了这个问题,将版本绑定到3.7.3,没有^(我面临的问题是3.7.4,我仍然不知道主要原因,但降级到3.7.3为我解决了这个问题)。

= =更新以防万一,有一个相关的bug报告https://github.com/ngxs/store/issues/1855

最新更新