问题
T(n) = T(n-1) + T(n-2)
添加服务人员
Unhandled requests will be served from: http://localhost:8080
Hit CTRL-C to stop the server
[2019-06-21T06:37:57.110Z] "GET /" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.
建筑项目
ng add @angular/pwa --project *project-name*
与http服务器一起使用
http服务器-p 8080 -c-1 dist /
ng build --prod
index.html
PS D:\angular-tour-of-heroes> http-server -p 8080 -c-1 dist/angular-tour-of-heroes
http://localhost:8080
Starting up http-server, serving ./
Available on:
http://192.168.0.179:8080
http://127.0.0.1:8080
Unhandled requests will be served from: http://localhost:8080
Hit CTRL-C to stop the server
[2019-06-21T06:37:57.110Z] "GET /" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"
(node:3348) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
[2019-06-21T06:38:09.511Z] "GET /" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"
[2019-06-21T06:38:09.653Z] "GET /" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"
[2019-06-21T06:38:14.680Z] "GET /" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"
[2019-06-21T07:17:49.186Z] "GET /" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"
[2019-06-21T07:17:49.249Z] "GET /" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"
[2019-06-21T07:17:54.683Z] "GET /" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"
[2019-06-21T07:17:54.775Z] "GET /" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"
manifest.webmanifest
<link rel="manifest" href="manifest.webmanifest">
更新的清单
{
"name": "angular-tour-of-heroes",
"short_name": "angular-tour-of-heroes",
"theme_color": "#1976d2",
"background_color": "#fafafa",
"display": "standalone",
"scope": "/",
"start_url": "http://localhost:8080/",
"icons": [
{
"src": "assets/icons/icon-72x72.png",
"sizes": "72x72",
"type": "image/png"
},
]
}
试图再次运行
{
"name": "angular-tour-of-heroes",
"short_name": "angular-tour-of-heroes",
"theme_color": "#1976d2",
"background_color": "#fafafa",
"display": "standalone",
"scope": "/",
"start_url": "/",
"icons": [
已安装
PS D:\angular-tour-of-heroes> http-server -p 8080 -c-1 dist/angular-tour-of-heroes
Starting up http-server, serving dist/angular-tour-of-heroes
Available on:
http://192.168.0.179:8080
http://127.0.0.1:8080
Hit CTRL-C to stop the server
[2019-06-27T05:30:36.720Z] "GET /" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36"
(node:3160) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
[2019-06-27T05:30:36.727Z] "GET /" Error (404): "Not found"
https://www.npmjs.com/package/http-server
ng verison
npm install http-server -g
Angular.json
Angular CLI: 8.0.3
Node: 12.4.0
OS: win32 x64
Angular: 8.0.1
... animations, cdk, common, compiler, compiler-cli, core, forms
... language-service, material, platform-browser
... platform-browser-dynamic, router, service-worker
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.800.3
@angular-devkit/build-angular 0.800.3
@angular-devkit/build-optimizer 0.800.3
@angular-devkit/build-webpack 0.800.3
@angular-devkit/core 8.0.3
@angular-devkit/schematics 8.0.3
@angular/cli 8.0.3
@angular/http 7.2.15
@angular/pwa 0.800.3
@ngtools/webpack 8.0.3
@schematics/angular 8.0.3
@schematics/update 0.800.3 (cli-only)
rxjs 6.5.2
typescript 3.4.5
webpack 4.30.0
Package.json
"configurations": {
"production": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"serviceWorker": true,
"ngswConfigPath": "ngsw-config.json"
}
main.ts
来自
"dependencies": {
"@angular/animations": "8.0.1",
"@angular/cdk": "~8.0.1",
"@angular/common": "8.0.1",
"@angular/compiler": "8.0.1",
"@angular/core": "8.0.1",
"@angular/forms": "8.0.1",
"@angular/http": "7.2.15",
"@angular/material": "^8.0.1",
"@angular/platform-browser": "8.0.1",
"@angular/platform-browser-dynamic": "8.0.1",
"@angular/pwa": "^0.800.3",
"@angular/router": "8.0.1",
"@angular/service-worker": "8.0.1",
到
platformBrowserDynamic().bootstrapModule(AppModule);
我已停止http://localhost:4200/以便可以使用http服务。
我不知道为什么localhost:8080无法正常工作
答案 0 :(得分:0)
在您的angular.json
文件中,尝试将生产版本的aot设置为false – "aot": false,
答案 1 :(得分:0)
使用http-server-spa而不是http-server帮助我解决了该问题。
https://developer.okta.com/blog/2019/01/30/first-angular-pwa