我有一个在Mac osx Mojave上工作的项目的开发环境。但是,由于内存RAM问题,我决定降级为Maosx High Sierra。现在,我正尝试再次部署该项目,但面临以下问题
node_modules/@types/lodash/common/object.d.ts(1689,12): error TS2304: Cannot find name 'Exclude'.
1689 ): Exclude<TObject[TKey], undefined> | TDefault;
这是试图编译此部分的脚本的一部分:tsc ./src/app/+charts/index.ts --outFile ./shared/charts.js --module amd --pretty
。因此,它使用全局Typescript进行编译。我已经全局安装了3.4、2.6和2.8版本,但是在所有这些版本中,我都遇到相同的错误。另外,此项目的正确节点版本为8,所以我使用的是8.16.0(这是格式化计算机之前使用的版本)。
这是我的package.json
"dependencies": {
"@angular/animations": "^5.2.0",
"@angular/cdk": "^5.1.0",
"@angular/common": "^5.2.0",
"@angular/compiler": "^5.2.0",
"@angular/core": "^5.2.0",
"@angular/forms": "^5.2.0",
"@angular/http": "^5.2.0",
"@angular/material": "^5.1.0",
"@angular/platform-browser": "^5.2.0",
"@angular/platform-browser-dynamic": "^5.2.0",
"@angular/platform-server": "^5.2.0",
"@angular/router": "^5.2.0",
"@covalent/core": "1.0.0",
"@covalent/dynamic-forms": "1.0.0",
"@covalent/highlight": "1.0.0",
"@covalent/http": "1.0.0",
"@covalent/markdown": "1.0.0",
"@covalent/text-editor": "1.0.0",
"@ngx-translate/core": "^8.0.0",
"@ngx-translate/http-loader": "^2.0.0",
"@swimlane/ngx-charts": "^7.0.1",
"@types/d3": "^5.0.0",
"angular2-text-mask": "^9.0.0",
"core-js": "^2.4.1",
"cors": "^2.8.4",
"d3": "^4.9.0",
"d3-format": "^1.2.0",
"exceljs": "^0.5.1",
"hammerjs": "^2.0.8",
"highlight.js": "9.10.0",
"html-pdf": "^2.1.0",
"libphonenumber-js": "1.0.24",
"lodash": "^4.17.4",
"moment": "2.21.0",
"moment-range": "3.1.1",
"ngx-currency": "^1.1.2",
"nodemon": "^1.11.0",
"requirejs": "^2.3.6",
"rxjs": "^5.5.6",
"showdown": "1.6.4",
"web-animations-js": "2.2.5",
"webshot": "^0.18.0",
"zone.js": "^0.8.20"
},
"devDependencies": {
"@angular/cli": "^1.7.3",
"@angular/compiler-cli": "^5.2.0",
"@types/hammerjs": "2.0.30",
"@types/jasmine": "2.5.38",
"@types/lodash": "^4.14.110",
"@types/node": "~6.0.60",
"@types/selenium-webdriver": "2.53.36",
"codelyzer": "~4.0.0",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^0.3.0",
"karma-jasmine": "^1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-phantomjs-launcher": "^1.0.4",
"karma-remap-istanbul": "^0.6.0",
"karma-spec-reporter": "^0.0.31",
"phantomjs-prebuilt": "2.1.14",
"prepend-file": "^1.3.1",
"protractor": "~5.1.0",
"ts-node": "3.1.0",
"tslint": "^5.2.0",
"typescript": "~2.6.2",
"watch": "^1.0.2"
},
我也尝试将行"@types/lodash": "^4.14.110",
更改为"@types/lodash": "^4.14.121",
,但这也不起作用。而且,我不确定更改package.json中的内容是否有意义,因为在格式化计算机并降级操作系统之前,我已经使该项目正常运行了
那么,我在这里想念什么?我将不胜感激任何帮助。预先感谢
答案 0 :(得分:0)
好像是@types/lodash
的问题,您可以在这里查找问题:https://github.com/DefinitelyTyped/DefinitelyTyped/issues/33778
解决方案似乎是downgrade @types/lodash
to
npm i -D @types/lodash@ts2.5
typescript@~2.8