Angular 2 Tutorial on OS X El Capitan Returns “Cannot GET /” in browser

淺唱寂寞╮ 提交于 2019-12-11 04:22:07

问题


I'm trying to get through the Angular 2 with TypeScript on OS X. I have followed the tutorial and received no errors when compiled. The npm start command completed successfully and a new tab was displayed in Safari. The address is http://localhost:3000 the only thing that showed was

Cannot GET /

I am not familiar with Lite-Server and I don't know if I've failed to start something to get the tutorial running.

Is there something I've missed or some way to determine if the Lite-Server is running?


回答1:


I suspect your folder/file structure might be confusing lite-server.

lite-server will look for a bs-config.json file. This should be at the same level as your node_modules folder.

Here is the github page for lite-servier.

For example, to change the server port, watched file paths, and base directory for your project, create a bs-config.json in your project's folder:

bs-config.json

{
  "port": 8000,
  "files": ["./src/**/*.{html,htm,css,js}"],
  "server": { "baseDir": "./src" }
}


来源:https://stackoverflow.com/questions/38209427/angular-2-tutorial-on-os-x-el-capitan-returns-cannot-get-in-browser

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!