我使用命令ng update --all --force
将角度从6升级到8。升级成功。当我执行ng serve
时,它也可以成功服务,如下所示
但是,当我访问localhost:4300
时,它显示空白页,而浏览器控制台日志中没有任何错误。这是我的ng版本
我的angular.jsonn
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"lightsmind-website": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/browser",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css",
"node_modules/angular2-toaster/toaster.css"
],
"scripts": [
"src/assets/js/vendor/jquery-1.11.2.min.js"
]
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "lightsmind-website:build"
},
"configurations": {
"production": {
"browserTarget": "lightsmind-website:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "lightsmind-website:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [
"src/styles.css"
],
"scripts": [],
"assets": [
"src/favicon.ico",
"src/assets"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"server": {
"builder": "@angular-devkit/build-angular:server",
"options": {
"outputPath": "dist/server",
"main": "src/main.server.ts",
"tsConfig": "src/tsconfig.server.json"
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
]
}
}
}
}
},
"lightsmind-website-e2e": {
"root": "e2e/",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "lightsmind-website:serve"
},
"configurations": {
"production": {
"devServerTarget": "lightsmind-website:serve:production"
}
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "lightsmind-website"
}
我的package.json
{
"name": "lightsmind-website",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"compile:server": "webpack --config webpack.server.config.js --progress --colors",
"serve:ssr": "node dist/server",
"build:ssr": "npm run build:client-and-server-bundles && npm run compile:server",
"build:client-and-server-bundles": "ng build --prod && ng run lightsmind-website:server:production",
"build:ssr-firebase": "npm run build:ssr && npm --prefix functions/ run build"
},
"private": true,
"dependencies": {
"@angular/animations": "^8.1.0-next.3",
"@angular/common": "^8.1.0-next.3",
"@angular/compiler": "^8.1.0-next.3",
"@angular/core": "^8.1.0-next.3",
"@angular/forms": "^8.1.0-next.3",
"@angular/platform-browser": "^8.1.0-next.3",
"@angular/platform-browser-dynamic": "^8.1.0-next.3",
"@angular/platform-server": "^8.1.0-next.3",
"@angular/router": "^8.1.0-next.3",
"@nguniversal/express-engine": "8.2.6",
"@nguniversal/module-map-ngfactory-loader": "8.2.6",
"@types/braintree-web": "^3.47.1",
"@types/express": "^4.17.2",
"@types/file-saver": "^2.0.1",
"angular2-toaster": "^8.0.0",
"braintree-web": "^3.56.0",
"core-js": "^3.6.0",
"express": "^4.17.1",
"file-saver": "^2.0.2",
"ng2-loading-spinner": "^1.3.0",
"ngx-bootstrap": "^5.2.0",
"ngx-cookie": "^4.0.2",
"ngx-pagination": "^5.0.0",
"rxjs": "^6.5.3",
"tslib": "^1.10.0",
"zone.js": "^0.9.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.803.21",
"@angular/cli": "^8.3.21",
"@angular/compiler-cli": "^8.1.0-next.3",
"@angular/language-service": "^8.1.0-next.3",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.8",
"@types/node": "~12.12.21",
"bufferutil": "^4.0.1",
"codelyzer": "^5.2.1",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.4.1",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~2.1.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.2",
"protractor": "~5.4.2",
"ts-loader": "^6.2.1",
"ts-node": "~8.5.4",
"tslint": "~5.20.1",
"typescript": "3.5.3",
"utf-8-validate": "^5.0.2",
"webpack-cli": "^3.3.10",
"ws": "^7.2.1",
"xhr2": "^0.2.0"
}
}
我的tsconfing.json
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"downlevelIteration": true,
"importHelpers": true,
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"module": "esnext",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es2015",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
}
}