由于某种原因,我突然收到此错误。它可能是angular-cli`的版本问题,但我找不到问题。感谢您的帮助!
npm i
仅显示一些警告,编译器在那里。如果我从对等方依赖项警告中安装了该特定版本,则下次我执行npm i
时会弹出另一个版本的警告,而ng serve
上的错误无法解决。
这是我的package.json
:
"dependencies": {
"@angular/animations": "^7.2.0",
"@angular/cdk": "^7.2.0",
"@angular/common": "^7.2.0",
"@angular/core": "^7.2.0",
"@angular/forms": "^7.2.0",
"@angular/http": "^7.2.0",
"@angular/material": "^7.2.0",
"@angular/platform-browser": "^7.2.0",
"@angular/platform-browser-dynamic": "^7.2.0",
"@angular/router": "^7.2.0",
"@ngx-translate/core": "^11.0.1",
"@ngx-translate/http-loader": "^4.0.0",
"@types/dygraphs": "^1.1.8",
"acorn": "^6.2.1",
"angular-material-fileupload": "^2.0.0",
"animate.css": "^3.7.2",
"blueimp-canvas-to-blob": "^3.15.0",
"bootstrap": "^4.1.3",
"browserify-fs": "^1.0.0",
"chart.js": "^2.7.3",
"coaty": "^1.5.0",
"cordova-android": "^8.0.0",
"cordova-create": "^2.0.0",
"cordova-lib": "^9.0.1",
"cordova-plugin-add-swift-support": "^2.0.1",
"cordova-plugin-console": "^1.1.0",
"cordova-plugin-device": "^2.0.3",
"cordova-plugin-ionic-webview": "^4.1.1",
"cordova-plugin-whitelist": "^1.3.4",
"cordova-plugin-zeroconf": "^1.4.0",
"core-js": "^2.5.4",
"d3": "^5.7.0",
"dygraphs": "^2.1.0",
"e2e": "0.0.8",
"express": "^4.17.1",
"fast-xml-parser": "^3.15.0",
"forever-agent": "^0.6.1",
"hammerjs": "^2.0.8",
"insight": "^0.10.3",
"ng-pick-datetime": "^7.0.0",
"ngx-cookie-service": "^2.2.0",
"ngx-toastr": "^10.0.4",
"nodejs-base64": "^1.0.3",
"promzard": "^0.3.0",
"read": "^1.0.7",
"request": "^2.88.0",
"rxjs": "~6.3.3",
"spdx-exceptions": "^2.2.0",
"spdx-expression-parse": "^3.0.0",
"spdx-license-ids": "^3.0.5",
"sxml": "^1.0.4",
"tough-cookie": "^3.0.1",
"tslib": "^1.9.0",
"tunnel-agent": "^0.6.0",
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular-builders/custom-webpack": "^7.2.0",
"@angular-builders/dev-server": "^7.2.0",
"@angular-devkit/build-angular": "^0.803.23",
"@angular/cli": "^7.1.0",
"@angular/compiler": "^7.2.0",
"@angular/compiler-cli": "^7.2.0",
"@angular/language-service": "^7.2.0",
"@types/d3": "^5.0.0",
"@types/jasmine": "~3.3.5",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~10.12.18",
"but": "^2.0.1",
"canvas": "^2.6.0",
"codelyzer": "~4.5.0",
"conventional-changelog": "^3.1.8",
"conventional-recommended-bump": "^5.0.0",
"cordova": "^9.0.0",
"jasmine-core": "~3.3.0",
"jasmine-spec-reporter": "~4.2.1",
"jquery": "^1.9.1",
"json-loader": "^0.5.7",
"karma": "~3.1.4",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"popper.js": "^1.16.0",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.12.1",
"typescript": "^3.5.3"
},
答案 0 :(得分:1)
删除依赖项版本中的所有^
,以便将其锁定到该依赖项的特定版本(您的工作配置)。当您执行npm install
时,它将安装锁定的版本。 ^
表示:此版本或更高版本(如果有)。将来,这会导致冲突,因为依赖关系会发生很大变化。