按照https://angular-update-guide.firebaseapp.com/
中描述的步骤将我的角度4应用升级为5我使用@latest安装了所有最新的软件包,而不是上面链接中提到的特定版本。
ng serve --open失败并出现以下错误
错误错误TS2688:无法找到' flex-layout'的类型定义文件。
我在@ angular / flex-layout /
看到一个文件flex-layout.d.ts 下面的是我的package.json文件
{
"name": "ui",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"build:universal": "npm run build:client-and-server-bundles && npm run webpack:server",
"serve:universal": "node dist/server.js",
"build:client-and-server-bundles": "ng build --prod && ng build --prod --app 1 --output-hashing=false",
"webpack:server": "webpack --config webpack.server.config.js --progress --colors"
},
"private": true,
"dependencies": {
"@agm/core": "^1.0.0-beta.2",
"@angular/animations": "^5.2.4",
"@angular/cdk": "^2.0.0-beta.12",
"@angular/common": "^5.2.4",
"@angular/compiler": "^5.2.4",
"@angular/core": "^5.2.4",
"@angular/flex-layout": "^2.0.0-beta.12",
"@angular/forms": "^5.2.4",
"@angular/http": "^5.2.4",
"@angular/material": "^2.0.0-beta.12",
"@angular/platform-browser": "^5.2.4",
"@angular/platform-browser-dynamic": "^5.2.4",
"@angular/platform-server": "^5.2.4",
"@angular/router": "^5.2.4",
"@nguniversal/express-engine": "^5.0.0-beta.5",
"@nguniversal/module-map-ngfactory-loader": "^5.0.0-beta.5",
"core-js": "^2.4.1",
"font-awesome": "^4.7.0",
"hammerjs": "^2.0.8",
"ngx-gallery": "^3.1.0",
"rxjs": "^5.5.2",
"ts-loader": "^3.5.0",
"zone.js": "^0.8.14"
},
"devDependencies": {
"@angular/cli": "^1.6.8",
"@angular/compiler-cli": "^5.2.4",
"@angular/language-service": "^4.2.4",
"@types/google.analytics": "0.0.37",
"@types/googlemaps": "^3.30.3",
"@types/jasmine": "^2.8.6",
"@types/jasminewd2": "~2.0.2",
"@types/node": "^9.4.5",
"codelyzer": "~3.2.0",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "^4.1.0",
"tslint": "~5.7.0",
"typescript": "2.4.2"
}
}

答案 0 :(得分:0)
您是否将flexLayoutModule
导入了app.module.ts
中?如果没有,请使用以下行将其导入:
import {FlexLayoutModule} from '@angular/flex-layout';
还要在FlexLayoutModule
文件的imports数组中包含app.module.ts
。