简体   繁体   English

打字稿5分钟教程,Angular2中断

[英]Typescript 5 minute tutorial with angular2 breaks on get

I am attempting to understand typscript and angular2 by following the https://angular.io/guide/quickstart . 我正在尝试通过遵循https://angular.io/guide/quickstart来理解打字稿和angular2。

I went through the various steps but the last step npm start result in the following errors 我经历了各个步骤,但最后一步npm start导致以下错误

Microsoft Windows [Version 10.0.10586]
(c) 2015 Microsoft Corporation. All rights reserved.

J:\workspace\epimss\typescript\angular2-quickstart>npm start

> angular2-quickstart@1.0.0 start J:\workspace\epimss\typescript\angular2-quickstart
> concurrently "npm run tsc:w" "npm run lite"

[0] 
[0] > angular2-quickstart@1.0.0 tsc:w J:\workspace\epimss\typescript\angular2-quickstart
[0] > tsc -w
[0] 
[1] 
[1] > angular2-quickstart@1.0.0 lite J:\workspace\epimss\typescript\angular2-quickstart
[1] > lite-server
[1] 
[0] 7:51:31 PM - Compilation complete. Watching for file changes.
[1] Did not detect a `bs-config.json` or `bs-config.js` override file. Using lite-server defaults...
[1] ** browser-sync options **
[1] { injectChanges: false,
[1]   files: [ './**/*.{html,htm,css,js}' ],
[1]   server: { baseDir: './', middleware: [ [Function], [Function] ] } }
[1] [BS] Access URLs:
[1]  ------------------------------------
[1]        Local: http://localhost:3000
[1]     External: http://192.168.2.4:3000
[1]  ------------------------------------
[1]           UI: http://localhost:3001
[1]  UI External: http://192.168.2.4:3001
[1]  ------------------------------------
[1] [BS] Serving files from: ./
[1] [BS] Watching files...
[1] 16.03.09 19:51:36 404 GET /index.html
[1] 16.03.09 19:51:37 404 GET /favicon.ico
[1] 16.03.09 19:51:38 404 GET /favicon.ico

Has anyone has a similar experience? 有没有人有类似的经历?

Thanks 谢谢

After you finish the tutorial you will get a folder structure like in the picture below, now for lite-server to serve from app and node_modules folders you need to add a bs-config.json file in angular2-quickstart folder. 完成本教程后,您将获得一个文件夹结构,如下图所示,现在要使 lite-server从appnode_modules文件夹中提供服务,您需要在angular2-quickstart文件夹中添加bs-config.json文件。

在此处输入图片说明

{
  "port": 3000,
  "files": ["/app/**/*.{html,htm,css,js}"],
  "server": { "baseDir": ["./app"],
              "routes": {
                  "/node_modules": "node_modules" , "/app": "app", "/app.component": "app"
              }
    }
}
[1] [BS] Serving files from: ./

Followed by 其次是

[1] 16.03.09 19:51:36 404 GET /index.html
[1] 16.03.09 19:51:37 404 GET /favicon.ico

Just means that those files ( index.html , favicon.ico ) are not in that location ( ./ ). 仅表示这些文件( index.htmlfavicon.ico )不在该位置( ./ )。

You'll need to browse to the location that does contain those files, or move those files to the location you are browsing. 您需要浏览到包含这些文件的位置,或者将那些文件移动到您正在浏览的位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM