如何解决我的项目中的标识符重复“ moment”
我是Angular和前端开发的新手。当我执行构建过程时,它在上下文下面抛出一个错误。
../../../../../../../node_modules/moment/ts3.1-typings/moment.d.ts(2,18): error TS2300: Duplicate identifier '"moment"'.
../../../../../../../node_modules/moment/ts3.1-typings/moment.d.ts(4,19): error TS2300: Duplicate identifier '"moment"'.
../../../../../../../node_modules/moment-timezone/index.d.ts(3,16): error TS2300: Duplicate identifier '"moment"'.
error TS2345: Argument of type 'Date' is not assignable to parameter of type 'string'.
我认为这应该是moment
模块上的一些版本不匹配的问题,但我很难弄清楚为什么会发生此错误。
下面是我的package.json
。
{
"name": "test","version": "0.0.1","scripts": {
"ng": "ng","start": "ng serve --live-reload false","build": "ng build","build:stats": "ng build --stats-json","analyze": "webpack-bundle-analyzer -p 9999 target/classes/resource/stats.json","prod": "node --max_old_space_size=10240 ./node_modules/.bin/ng build --prod --deploy-url /resource/ --output-hashing all --base-href /app/","test": "ng test","lint": "./node_modules/.bin/nx lint && ng lint","e2e": "ng e2e","affected:apps": "./node_modules/.bin/nx affected:apps","affected:libs": "./node_modules/.bin/nx affected:libs","affected:build": "./node_modules/.bin/nx affected:build","affected:e2e": "./node_modules/.bin/nx affected:e2e","affected:test": "./node_modules/.bin/nx affected:test","affected:lint": "./node_modules/.bin/nx affected:lint","affected:dep-graph": "./node_modules/.bin/nx affected:dep-graph","affected": "./node_modules/.bin/nx affected","format": "./node_modules/.bin/nx format:write","format:write": "./node_modules/.bin/nx format:write","format:check": "./node_modules/.bin/nx format:check","update": "ng update @nrwl/schematics","update:check": "ng update","workspace-schematic": "./node_modules/.bin/nx workspace-schematic","dep-graph": "./node_modules/.bin/nx dep-graph","help": "./node_modules/.bin/nx help","build:lib:page-grid": "ng-packagr -p libs/page/grid/ng-package.json","compodoc": "./node_modules/.bin/compodoc -p ./apps/metatron-apm/tsconfig.app.json -s"
},"private": true,"dependencies": {
"@angular/animations": "^7.2.8","@angular/cdk": "^7.2.1","@angular/common": "^7.0.0","@angular/compiler": "^7.0.0","@angular/core": "^7.0.0","@angular/forms": "^7.0.0","@angular/material": "^7.2.1","@angular/platform-browser": "^7.0.0","@angular/platform-browser-dynamic": "^7.0.0","@angular/router": "^7.0.0","@ng-select/ng-select": "^2.20.5","@ngrx/effects": "^7.2.0","@ngrx/entity": "^7.4.0","@ngrx/router-store": "^7.0.0","@ngrx/store": "^7.2.0","@ngx-translate/core": "^11.0.1","@ngx-translate/http-loader": "^4.0.0","@nrwl/nx": "7.5.2","@stomp/ng2-stompjs": "7.2.0","angular-in-memory-web-api": "^0.9.0","angular2-uuid": "^1.1.1","daterangepicker": "^3.0.5","echarts": "^4.2.0-rc.2","file-saver": "^2.0.2","html2canvas": "^1.0.0-rc.5","jquery": "1.12.4","lodash": "^4.17.11","moment": "^2.24.0","moment-range": "^4.0.2","ng-click-outside": "^4.0.0","ngx-echarts": "^4.2.2","ngx-quill": "^6.3.1","ngx-toastr": "^9.1.2","ngx-virtual-scroller": "^3.0.3","quill": "^1.3.7","quill-mention": "^2.2.5","rxjs": "~6.5.2","sockjs-client": "1.3.0","wavesurfer.js": "^3.3.3","xlsx": "^0.15.1","zone.js": "^0.8.26"
},"devDependencies": {
"@angular-devkit/build-angular": "^0.12.2","@angular-devkit/build-ng-packagr": "~0.11.0","@angular/cli": "~7.3.1","@angular/compiler-cli": "^7.0.0","@angular/language-service": "^7.0.0","@ngrx/schematics": "^7.2.0","@ngrx/store-devtools": "^7.4.0","@nguniversal/express-engine": "^7.1.0","@nrwl/builders": "7.5.2","@nrwl/schematics": "7.5.2","@types/date-fns": "^2.6.0","@types/echarts": "^4.4.0","@types/jasmine": "~2.8.6","@types/jasminewd2": "~2.0.3","@types/jest": "^23.0.0","@types/jquery": "3.3.6","@types/lodash": "^4.14.120","@types/node": "^8.9.5","codelyzer": "~4.5.0","cypress": "^3.1.0","express": "^4.16.4","jasmine-core": "~2.99.1","jasmine-marbles": "0.4.0","jasmine-spec-reporter": "~4.2.1","jest": "^23.0.0","jest-preset-angular": "6.0.1","ng-packagr": "^4.6.0","ngrx-store-freeze": "0.2.4","prettier": "1.15.2","ts-node": "~7.0.0","tsickle": ">=0.29.0","tslib": "^1.9.0","tslint": "~5.11.0","tslint-config-prettier": "^1.18.0","typescript": "~3.2.2","validator": "^10.11.0","webpack-bundle-analyzer": "^3.4.1"
}
}
我的节点版本为v10.12.0
。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。