Search code examples
angularjsnode.jstypescriptangularosx-elcapitan

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


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?


Solution

  • 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" }
    }