我得到了50个错误,都说角/核心/核心没有导出成员'eeFactoryDef‘。
它们来自不同的node_modules,例如角/cdk,ng-引导,ngx-管道,ng2-dragula等。我也没有从谷歌找到任何东西。
../node_modules/@angular/cdk/drag-drop/typings/directives/drag-handle.d.ts:23:33 - error TS2694: Namespace '"/Users/heikopiirme/Documents/realNewClient/client/node_modules/@angular/core/core"' has no exported member 'ɵɵFactoryDef'.
23 static ngFactoryDef: ɵngcc0.ɵɵFactoryDef<CdkDragHandle>;这是我的package.json文件:
以下是我的信任度:
"@angular-skyhook/core": "^1.1.1",
"@angular-skyhook/multi-backend": "^1.1.1",
"@angular/animations": "^8.2.6",
"@angular/cdk": "^8.2.0",
"@angular/common": "^8.2.6",
"@angular/compiler": "^8.2.6",
"@angular/core": "^8.2.6",
"@angular/forms": "^8.2.6",
"@angular/http": "^7.1.4",
"@angular/material": "^8.2.0",
"@angular/platform-browser": "^8.2.6",
"@angular/platform-browser-dynamic": "^8.2.6",
"@angular/router": "^8.2.6",
"@ng-bootstrap/ng-bootstrap": "^5.1.1",
"@ng-select/ng-select": "^3.0.7",
"@swimlane/ngx-datatable": "^13.1.0",
"@types/googlemaps": "^3.36.5",
"angular2-draggable": "^2.3.1",
"bootstrap": "^4.2.1",
"core-js": "^2.6.1",
"drag-drop-webkit-mobile": "^1.4.1",
"exif-js": "^2.3.0",
"hammerjs": "^2.0.8",
"mobile-drag-drop": "^2.3.0-rc.2",
"moment": "^2.24.0",
"moment-range": "^4.0.2",
"net": "^1.0.2",
"ng2-dnd": "^5.0.2",
"ng2-dragula": "^2.1.1",
"ng2-file-upload": "^1.3.0",
"ng2-img-max": "^2.1.18",
"ngx-bar-rating": "^1.1.0",
"ngx-bootstrap": "^4.3.0",
"ngx-material-timepicker": "^5.1.0",
"ngx-permissions": "^5.0.0",
"ngx-pipes": "2.5.6",
"ngx-toastr": "^10.0.4",
"react-dnd-html5-backend": "^7.6.0",
"rxjs": "^6.5.3",
"sockjs-client": "^1.3.0",
"stompjs": "^2.3.3",
"touchscreen-dnd-shim": "^1.2.2",
"underscore": "^1.9.1",
"zone.js": "~0.9.1"下面是我的dev依赖项:
"@angular-devkit/build-angular": "^0.803.4",
"@angular/cli": "~8.3.4",
"@angular/compiler-cli": "^8.2.6",
"@angular/language-service": "^8.2.6",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^8.9.5",
"codelyzer": "~5.0.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~3.1.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"node-sass": "^4.12.0",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "~3.5.3"
}由于某种原因无法在谷歌上找到任何信息。
发布于 2020-01-14 20:45:30
在更新了一些包(包括从8到9的角度)之后,我遇到了这个问题,然后再次降级。
解决方案是对node_modules文件夹进行核弹,然后执行新的npm安装。
发布于 2020-08-10 12:57:55
我也会犯同样的错误。我使用的是角9.7.1,我首先尝试删除node_modules和npm安装,但是它没有工作,所以我最终修复了它,将它添加到tsconfig.json中:
"compilerOptions":{
[...]
"paths": {
"@angular/*": ["./node_modules/@angular/*"]
}
}发布于 2022-05-10 12:30:51
很多人说这里的解决方案就是“删除你的node_modules”。,这可能工作,也可能不工作,。
要理解为什么会出现这种情况,您需要了解为什么会出现此错误。这是由造成的--角度上的急剧变化,使用角版本x生成的代码与角版本y不兼容(发生在多个版本中,我目前得到的代码介于10到13之间)。eeFactoryDef是在编译源时由角生成的方法。多年来,此方法的名称已更改。所以delete node_modules可以工作,因为它假设您刚刚升级了角,并且仍然有一个旧版本挂着。
这也解释了为什么这个问题有这么多不同的答案。角度上的不兼容性可能在您的代码中,或者它的一个依赖项中。所有说“我在x库中得到这个信息”的人,基本上都是因为这个潜在的问题。
但是,如果存在依赖问题,也可以得到这个问题。诊断此问题的最简单方法是运行npm ls @angular/core。这将列出链接到此库的所有库依赖项,例如:
`-- UNMET PEER DEPENDENCY @angular/core@13.2.5
npm ERR! peer dep missing: @angular/core@~11.2.13, required by blah@2.1.1
npm ERR! peer dep missing: @angular/core@12.2.15, required by blah@13.0.4
npm ERR! peer dep missing: @angular/core@^11.0.5, required by blah@11.0.5
npm ERR! peer dep missing: @angular/core@^6.0.0 || ^7.0.0 || ^8.0.0, required by ngx-avatar@3.7.0在这个场景中,您需要升级冲突的库,以便它们都使用相同(或兼容)版本的re( node_modules的删除和重新添加不会产生任何影响)。
另一个将此作为症状的问题是常春藤编译器。同样,这可能会在库和应用程序之间产生不兼容的构建。这里的解决方案取决于不兼容的位置。如果库不是常春藤,但应用程序是常春藤,那么可以选择选择退出常春藤 (https://stackoverflow.com/questions/58078033/ng-serve-throwing-angular-core-core-has-no-exported-member-eefactorydef/72186353#comment130039090_72186353)
tsconfig.json
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
},
"files": [
"src/main.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.d.ts"
],
"angularCompilerOptions": {
"enableIvy": false
}
}或在postinstall事件中运行ngcc:
package.json
{
"scripts": {
"postinstall": "ngcc"
}
}https://stackoverflow.com/questions/58078033
复制相似问题