node.js - 模块 '"../../../../@types/parse5"' 没有导出的成员 'DefaultTreeElement'
问题描述
尝试构建 Angular 应用程序时,出现此错误:
node_modules/@angular/cdk/schematics/utils/html-manipulation.d.ts:9:10 - error TS2305: Module '"../../../../@types/parse5"' has no exported member 'DefaultTreeElement'.
Angular 11.2.14
Angular CLI: 11.2.13
Node: 14.17.0
我正在与另外 4 个使用相同应用程序的人一起工作,但没有人遇到这个问题。
我尝试了以下不起作用的解决方案:
- 删除整个应用程序并将其从 git 克隆回来。
- 清除 node_modules 并重新安装它。
- 更新了 Node.js(到当前版本)
- 更新了 npm(到当前的)
- 更新了 Angular CLI(到当前版本)
- 安装 @types/parse5 (使用 npm install @types/parse5)
在这些之间我做了一个 npm cache clean -f
这就是 package.json 现在的样子:
{
"name": "rferp",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"postinstall": "ngcc"
},
"private": true,
"dependencies": {
"@angular-devkit/build-angular": "^0.1102.5",
"@angular-devkit/core": "^11.2.5",
"@angular/animations": "^11.2.6",
"@angular/cdk": "^11.2.13",
"@angular/common": "^11.2.14",
"@angular/compiler": "^11.2.14",
"@angular/core": "^11.2.14",
"@angular/flex-layout": "^11.0.0-beta.33",
"@angular/forms": "^11.2.14",
"@angular/platform-browser": "^11.2.14",
"@angular/platform-browser-dynamic": "^11.2.14",
"@angular/router": "^11.2.14",
"@fullcalendar/core": "^5.4.0",
"@fullcalendar/daygrid": "^5.4.0",
"@fullcalendar/interaction": "^5.4.0",
"@fullcalendar/rrule": "^5.4.0",
"@fullcalendar/timegrid": "^5.4.0",
"@ngrx/component-store": "^11.0.1",
"@ngrx/effects": "^11.0.1",
"@ngrx/entity": "^11.0.1",
"@ngrx/router-store": "^11.0.1",
"@ngrx/store": "^11.0.1",
"@ngrx/store-devtools": "^11.0.1",
"@types/bingmaps": "0.0.0",
"@types/node": "^13.13.33",
"@types/parse5": "^6.0.0",
"azure-maps-control": "^2.0.32",
"azure-maps-drawing-tools": "^0.1.6",
"chart.js": "^2.9.4",
"clone": "^2.1.2",
"core-js": "^3.8.0",
"exceljs": "^4.2.0",
"file-saver": "^2.0.5",
"font-awesome": "^4.7.0",
"moment": "^2.29.1",
"ng-azure-maps": "^4.0.0",
"parse5": "^6.0.1",
"prettier": "^2.2.0",
"primeicons": "^4.1.0",
"primeng": "^11.4.2",
"quill": "^1.3.7",
"rrule": "^2.6.6",
"rxjs": "~6.6.6",
"ts-node": "^8.10.2",
"tslib": "^2.0.0",
"zone.js": "^0.10.3"
},
"devDependencies": {
"@angular/cli": "^11.2.5",
"@angular/compiler-cli": "^11.2.6",
"@angular/language-service": "^11.2.6",
"@fortawesome/fontawesome-pro": "^5.15.1",
"@types/jasmine": "^3.6.2",
"@types/jasminewd2": "^2.0.6",
"@typescript-eslint/eslint-plugin": "^2.34.0",
"@typescript-eslint/parser": "^2.34.0",
"eslint": "^6.7.2",
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-prettier": "^3.1.3",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~6.2.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"ng-packagr": "^11.0.3",
"protractor": "~7.0.0",
"resize-observer-polyfill": "^1.5.1",
"typescript": "4.0.2"
}
}
解决方案
我也有同样的问题,几天前突然出现了。也使用 Angular 11。
不知何故,我认为 parse5 包已更新到版本 6.0.1,因为恢复到 5.0.0 修复了它。
推荐阅读
- php - 使用 PHP/Laravel 批量解析多个 XML 文件
- python - 训练我保存的 tensorflow 模型时出错
- python - Python - TypeError:需要一个整数(获取类型 datetime.datetime)
- python - 如何在python中使用特定路径调节excel文件的标题
- java - 字母数字序列生成器
- powershell - Power Shell 获取服务问题
- sql - 用于查找可能包含特殊字符的部分字符串匹配的 SQL 查询
- slf4j - 如何抑制未找到 SLF4J 记录器的警告?
- php - 同一页面/样式上的 PHP 成功消息
- r - R / Python - 将字符串列拆分为多个不同的列