这是我构建项目时的错误信息:
ERROR in node_modules/@angular/flex-layout/core/typings/match-media/mock/mock-match-media.d.ts(83,38): error TS2304: Cannot find name 'MediaQueryListEventMap'.
node_modules/@angular/flex-layout/core/typings/match-media/mock/mock-match-media.d.ts(83,99): error TS2304: Cannot find name 'MediaQueryListEventMap'.
node_modules/@angular/flex-layout/core/typings/match-media/mock/mock-match-media.d.ts(84,41): error TS2304: Cannot find name 'MediaQueryListEventMap'.
node_modules/@angular/flex-layout/core/typings/match-media/mock/mock-match-media.d.ts(84,102): error TS2304: Cannot find name 'MediaQueryListEventMap'.
node_modules/@angular/flex-layout/core/typings/match-media/mock/mock-match-media.d.ts(95,67): error TS2304: Cannot find name 'MediaQueryListEvent'.
node_modules/@angular/flex-layout/core/typings/match-media/server-match-media.d.ts(29,38): error TS2304: Cannot find name 'MediaQueryListEventMap'.
node_modules/@angular/flex-layout/core/typings/match-media/server-match-media.d.ts(29,99): error TS2304: Cannot find name 'MediaQueryListEventMap'.
node_modules/@angular/flex-layout/core/typings/match-media/server-match-media.d.ts(30,41): error TS2304: Cannot find name 'MediaQueryListEventMap'.
node_modules/@angular/flex-layout/core/typings/match-media/server-match-media.d.ts(30,102): error TS2304: Cannot find name 'MediaQueryListEventMap'.
node_modules/@angular/flex-layout/core/typings/match-media/server-match-media.d.ts(56,67): error TS2304: Cannot find name 'MediaQueryListEvent'.
我离开这个项目很长时间了。也许节点模块更新有问题,但是我不知道如何解决,这是package.json:
"dependencies": {
"@angular/animations": "^6.0.3",
"@angular/common": "^6.0.3",
"@angular/compiler": "^6.0.3",
"@angular/core": "^6.0.3",
"@angular/flex-layout": "^7.0.0-beta.23",
"@angular/forms": "^6.0.3",
"@angular/http": "^6.0.3",
"@angular/material": "^6.4.0",
"@angular/platform-browser": "^6.0.3",
"@angular/platform-browser-dynamic": "^6.0.3",
"@angular/router": "^6.0.3",
"core-js": "^2.5.4",
"font-awesome": "^4.7.0",
"rxjs": "^6.0.0",
"zone.js": "^0.8.26"
},
"devDependencies": {
"@angular/compiler-cli": "^6.0.3",
"@angular-devkit/build-angular": "~0.6.8",
"typescript": "~2.7.2",
"@angular/cli": "~6.0.8",
"@angular/language-service": "^6.0.3",
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "~4.2.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~1.7.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.0",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.3.0",
"ts-node": "~5.0.1",
"tslint": "~5.9.1"
}
说实话,我对角度更新感到非常沮丧。每次尝试“ npm install”时,我总是遇到一些问题。有没有更好的方法来解决这个问题。非常感谢你!
答案 0 :(得分:3)
我遇到了同样的问题,所以我尝试了
ng update --all
但这给了我
Package "@angular/compiler-cli" has an incompatible peer dependency to "typescript" (requires ">=3.1.1 <3.3", would install "3.3.3").
Package "@angular/compiler-cli" has an incompatible peer dependency to "typescript" (requires ">=3.1.1 <3.3", would install "3.3.3")
Incompatible peer dependencies found. See above.
这很适合我,简直是这样:
ng update --all --force
npm install typescript@">=3.1.1 <3.3.0"
答案 1 :(得分:0)
我有同样的问题。 删除文件夹“ node_modules”并重新安装node_modules 通过“ npm install”