每当我尝试运行ng serve
命令时,都会收到以下错误。下面是错误的详细信息。
node_modules/@types/lodash/common/collection.d.ts(1783,24)中的错误:错误TS2304:找不到名称“排除”。 node_modules/@types/lodash/common/collection.d.ts(1805,46):错误TS2304:找不到名称“排除”。 node_modules/@types/lodash/common/collection.d.ts(1827,46):错误TS2304:找不到名称“排除”。 node_modules/@types/lodash/common/object.d.ts(818,12):错误TS2304:找不到名称“ NonNullable”。 node_modules/@types/lodash/common/object.d.ts(827,12):错误TS2304:找不到名称“ NonNullable”。 node_modules/@types/lodash/common/object.d.ts(837,12):错误TS2304:找不到名称“ NonNullable”。 node_modules/@types/lodash/common/object.d.ts(848,12):错误TS2304:找不到名称“ NonNullable”。 node_modules/@types/lodash/common/object.d.ts(853,45):错误TS2304:找不到名称“ NonNullable”。 node_modules/@types/lodash/common/object.d.ts(870,34):错误TS2304:找不到名称“ NonNullable”。 node_modules/@types/lodash/common/object.d.ts(878,34):错误TS2304:找不到名称“ NonNullable”。 node_modules/@types/lodash/common/object.d.ts(887,34):错误TS2304:找不到名称“ NonNullable”。 node_modules/@types/lodash/common/object.d.ts(897,34):错误TS2304:找不到名称“ NonNullable”。 node_modules/@types/lodash/common/object.d.ts(902,43):错误TS2304:找不到名称“ NonNullable”。 node_modules/@types/lodash/common/object.d.ts(916,34):错误TS2304:找不到名称“ NonNullable”。 node_modules/@types/lodash/common/object.d.ts(924,34):错误TS2304:找不到名称“ NonNullable”。 node_modules/@types/lodash/common/object.d.ts(933,34):错误TS2304:找不到名称“ NonNullable”。 node_modules/@types/lodash/common/object.d.ts(943,34):错误TS2304:找不到名称“ NonNullable”。 node_modules/@types/lodash/common/object.d.ts(948,43):错误TS2304:找不到名称“ NonNullable”。 node_modules/@types/lodash/common/object.d.ts(1689,12):错误TS2304:找不到名称“排除”。 node_modules/@types/lodash/common/object.d.ts(1706,12):错误TS2304:找不到名称“排除”。 node_modules/@types/lodash/common/object.d.ts(1723,12):错误TS2304:找不到名称“排除”。 node_modules/@types/lodash/common/object.d.ts(1740,12):错误TS2304:找不到名称“排除”。 node_modules/@types/lodash/common/object.d.ts(1817,12):错误TS2304:找不到名称“排除”。 node_modules/@types/lodash/common/object.d.ts(1841,12):错误TS2304:找不到名称“排除”。 node_modules/@types/lodash/common/object.d.ts(1865,12):错误TS2304:找不到名称“排除”。 node_modules/@types/lodash/common/object.d.ts(1874,12):错误TS2304:找不到名称“排除”。 node_modules/@types/lodash/common/object.d.ts(1898,12):错误TS2304:找不到名称“排除”。 node_modules/@types/lodash/common/object.d.ts(1974,34):错误TS2304:找不到名称“排除”。 node_modules/@types/lodash/common/object.d.ts(1998,34):错误TS2304:找不到名称“排除”。 node_modules/@types/lodash/common/object.d.ts(2022,34):错误TS2304:找不到名称“排除”。 node_modules/@types/lodash/common/object.d.ts(2046,34):错误TS2304:找不到名称“排除”。 src / app / dashboard / dashboard.component.ts(5,21):错误TS2307:找不到模块'chart.js / src / chart.js'。
下面是我的package.json文件
{
"name": "TestApplication",
"version": "0.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"ng": "ng",
"start": "ng serve --host 0.0.0.0 --port 4200",
"hmr": "ng serve --host 0.0.0.0 --port 4200 4201 --hmr -e=hmr",
"test": "ng test",
"pree2e": "webdriver-manager update --standalone false --gecko false",
"e2e": "protractor"
},
"private": true,
"dependencies": {
"@angular/animations": "^5.2.5",
"@angular/cdk": "^5.2.5",
"@angular/common": "^5.2.5",
"@angular/compiler": "^5.2.5",
"@angular/core": "^5.2.5",
"@angular/forms": "^5.2.5",
"@angular/http": "^5.2.5",
"@angular/platform-browser": "^5.2.5",
"@angular/platform-browser-dynamic": "^5.2.5",
"@angular/router": "^5.2.5",
"@aspnet/signalr": "1.0.0-preview1-28189",
"@durwella/zoomable-canvas": "^1.1.0",
"@types/bootstrap": "^3.3.33",
"@types/jquery": "^3.2.12",
"@types/jquery.blockui": "0.0.28",
"@types/jquery.validation": "^1.16.3",
"@types/lodash": "^4.14.121",
"@types/moment": "^2.13.0",
"@types/moment-timezone": "^0.2.34",
"@types/signalr": "^2.2.33",
"@types/toastr": "^2.1.33",
"abp-ng2-module": "^2.0.0",
"abp-web-resources": "^3.5.0",
"adal-angular5": "^1.0.36",
"angular2-multiselect-dropdown": "^2.9.0",
"animate.css": "^3.5.2",
"block-ui": "^2.70.1",
"bootstrap": "^3.3.7",
"bootstrap-select": "^1.12.2",
"bootstrap-submenu": "^3.0.0",
"chart.js": "^2.6.0",
"core-js": "^2.4.1",
"famfamfam-flags": "^1.0.0",
"flot": "^0.8.0-alpha",
"font-awesome": "^4.7.0",
"jasmine": "^3.3.1",
"jquery": "^3.1.1",
"jquery-countto": "^1.2.0",
"jquery-migrate": "^3.0.0",
"jquery-slimscroll": "^1.3.8",
"jquery-sparkline": "^2.4.0",
"js-cookie": "^2.1.4",
"lodash": "^4.17.15",
"moment": "^2.18.1",
"moment-timezone": "^0.5.13",
"morris.js": "^0.5.0",
"ng2-charts": "^1.6.0",
"ng2-ckeditor": "^1.2.1",
"ng2-search-filter": "^0.4.7",
"ng2-toastr": "^4.1.2",
"ngx-bootstrap": "^2.0.2",
"ngx-debounce-click": "0.0.1",
"ngx-image-zoom": "^0.3.3",
"ngx-loading": "^2.0.1",
"ngx-pagination": "^3.0.3",
"ngx-pinch-zoom": "^1.2.0",
"ngx-spinner": "6.1.2",
"node-waves": "^0.7.5",
"push.js": "1.0.4",
"raphael": "^2.2.7",
"rxjs": "^5.5.2",
"signalr": "^2.2.1",
"simple-line-icons": "^2.4.1",
"spin.js": "^2.3.2",
"sweetalert": "^2.0.8",
"toastr": "^2.1.2",
"ts-helpers": "^1.1.2",
"web-animations-js": "^2.3.1",
"zone.js": "0.8.18"
},
"devDependencies": {
"@angular/cli": "^1.6.8",
"@angular/compiler-cli": "^5.2.5",
"@angularclass/hmr": "^2.1.3",
"@types/jasmine": "2.8.6",
"@types/jasminewd2": "2.0.3",
"@types/node": "^8.0.27",
"codelyzer": "^3.1.2",
"jasmine-core": "^2.5.2",
"jasmine-spec-reporter": "^4.2.1",
"karma": "^1.4.1",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-coverage-istanbul-reporter": "^1.3.0",
"karma-jasmine": "^1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"node-sass": "^4.13.0",
"nswag": "^11.12.7",
"protractor": "^5.1.1",
"ts-node": "^3.3.0",
"tslint": "^5.7.0",
"typescript": "2.5.3"
}
}
到目前为止,我已经尝试过:
任何想法/建议都值得赞赏。
答案 0 :(得分:0)
根据GitHub上的此链接:
error TS2304: Cannot find name 'Exclude'
它暗示您可能需要升级TypeScript版本或安装与您的type脚本版本兼容的loadash:
npm i -D @types/lodash@ts2.5.3
注意:您提到TypeScript 2.8.3,但您的package.json文件仍引用TypeScript 2.5.3。