Category Archives: node.js

Cannot GET / in Angular

I was playing with the quick start tutorial from Angular’s setup page on their web site.

Using the file/folder layout on their THE HERO EDITOR I removed all folders/files not listed in their diagram.

For completeness I’ll duplicate the information here

angular-tour-of-heroes
|—src
|—|—app
|—|—|—app.component.ts
|—|—|—app.module.ts
|—|—index.html
|—|—main.ts
|—|—styles.css
|—|—systemjs.config.js
|—|—tsconfig.json
|—node_modules …
|—package.json

I then ran npm start from the command prompt in the root angular-tour-of-heroes and up pops the browser with Cannot GET /, looking at the output from npm I could see index.html was not found by npm.

I also noticed npm couldn’t find a file bs-config.json, so I located that from the quick start and placed it in the root angular-tour-of-heroes folder and all worked correctly, no more 404.

Here’s why, the bs-confog.json gives the baseDir of the “website”, here’s the file context

{
  "server": {
    "baseDir": "src",
    "routes": {
      "/node_modules": "node_modules"
    }
  }
}