我的申请书和
ng serve
命令或命令
ng serve --prod
命令,但当我用
ng build --prod
命令,然后用
http-server -p 8080 -c-1 dist/ng-zero
命令或命令
live-server --entry-file=dist/index.html
404
回应。
我看了不同的问题和他们的答案,但没有任何帮助。我试过了
HashLocationStrategy
建议,我试过了
useHash: true
一个也没有成功。
$ http-server -p 8080 -c-1 dist/ng-zero
Starting up http-server, serving dist/ng-zero
Available on:
http://127.0.0.1:8080
http://192.168.0.7:8080
http://172.19.0.1:8080
Hit CTRL-C to stop the server
[Sat Oct 13 2018 11:19:38 GMT+0200 (CEST)] "GET /" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36"
[Sat Oct 13 2018 11:19:38 GMT+0200 (CEST)] "GET /" Error (404): "Not found"
它会在上打开一个新的浏览器选项卡
http://127.0.0.1:8080/
但它是空白的,控制台上写着:
[Sat Oct 13 2018 11:19:38 GMT+0200 (CEST)] "GET /" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36"
[Sat Oct 13 2018 11:19:38 GMT+0200 (CEST)] "GET /" Error (404): "Not found"
[Sat Oct 13 2018 11:20:51 GMT+0200 (CEST)] "GET /" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36"
[Sat Oct 13 2018 11:20:51 GMT+0200 (CEST)] "GET /" Error (404): "Not found"
启动应用程序的Lite服务器:
$ ll dist/index.html
-rw-rw-r-- 1 stephane 925 oct. 12 19:35 dist/index.html
[stephane@stephane-ThinkPad-X201 ng-zero (master)]
$ live-server --entry-file=dist/index.html
Serving "/home/stephane/dev/js/projects/angular/ng-zero" at http://127.0.0.1:8080
http://127.0.0.1:8080/
但它是空白的,控制台什么也没说。
这个
index.html
$ cat src/index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>NgZero</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="manifest" href="manifest.json">
<meta name="theme-color" content="#1976d2">
</head>
<body class="mat-app-background">
<app-root></app-root>
<noscript>Please enable JavaScript to continue using this application.</noscript>
</body>
</html>
编辑:
$ tree
.
âââ app
â  âââ app.component.css
â  âââ app.component.html
â  âââ app.component.spec.ts
â  âââ app.component.ts
â  âââ app-gui.module.ts
â  âââ app.module.ts
â  âââ app-preloading-strategy.ts
â  âââ app-routing.module.ts
â  âââ core
â  â  âââ auth
â  â  â  âââ auth-guard.service.ts
â  â  â  âââ auth.interceptor.ts
â  â  â  âââ auth.module.ts
â  â  â  âââ auth.service.ts
â  â  â  âââ keycloak-client.service.spec.ts
â  â  â  âââ keycloak-client.service.ts
â  â  â  âââ keycloak.interceptor.ts
â  â  â  âââ token.service.spec.ts
â  â  â  âââ token.service.ts
â  â  âââ error
â  â  â  âââ error.component.html
â  â  â  âââ error.component.scss
â  â  â  âââ error.component.ts
â  â  â  âââ error-custom-handler.ts
â  â  â  âââ error.module.ts
â  â  â  âââ error-request-interceptor.ts
â  â  â  âââ error-routing.module.ts
â  â  â  âââ error.service.ts
â  â  â  âââ index.ts
â  â  âââ login
â  â  â  âââ login.component.css
â  â  â  âââ login.component.html
â  â  â  âââ login.component.spec.ts
â  â  â  âââ login.component.ts
â  â  â  âââ login-dialog.component.html
â  â  â  âââ login-dialog.component.ts
â  â  âââ messages
â  â  â  âââ messages.component.css
â  â  â  âââ messages.component.html
â  â  â  âââ messages.component.spec.ts
â  â  â  âââ messages.component.ts
â  â  â  âââ message.service.spec.ts
â  â  â  âââ message.service.ts
â  â  âââ service
â  â  âââ http.service.ts
â  â  âââ notification.service.ts
â  â  âââ pagination.service.ts
â  â  âââ utils.service.ts
â  âââ core.module.ts
â  âââ material.module.ts
â  âââ views
â  âââ dashboard
â  â  âââ dashboard.component.css
â  â  âââ dashboard.component.html
â  â  âââ dashboard.component.spec.ts
â  â  âââ dashboard.component.ts
â  âââ home
â  â  âââ home.component.css
â  â  âââ home.component.html
â  â  âââ home.component.spec.ts
â  â  âââ home.component.ts
â  â  âââ home.module.ts
â  â  âââ home-routing.module.ts
â  âââ user
â  âââ search.component.css
â  âââ search.component.html
â  âââ search.component.spec.ts
â  âââ search.component.ts
â  âââ user.component.css
â  âââ user.component.html
â  âââ user.component.spec.ts
â  âââ user.component.ts
â  âââ users.component.css
â  âââ users.component.html
â  âââ users.component.spec.ts
â  âââ users.component.ts
â  âââ user.service.spec.ts
â  âââ user.service.ts
â  âââ user.ts
âââ assets
â  âââ icons
â  âââ icon-128x128.png
â  âââ icon-144x144.png
â  âââ icon-152x152.png
â  âââ icon-192x192.png
â  âââ icon-384x384.png
â  âââ icon-512x512.png
â  âââ icon-72x72.png
â  âââ icon-96x96.png
âââ environments
â  âââ environment.prod.ts
â  âââ environment.ts
âââ favicon.ico
âââ index.html
âââ main.ts
âââ manifest.json
âââ polyfills.ts
âââ styles.css
âââ test.ts
âââ tsconfig.app.json
âââ tsconfig.spec.json
âââ typings.d.ts
我是7号
^7.0.0-rc.0