6

I'm trying to run angular2 based first app. I followed angular2 steps. When i run command npm start then its giving following error in the terminal

Did not detect a bs-config.json or bs-config.js override file. Using lite-server defaults...

And also browser returning 404 error for index.html file (angular-project/app/index.html)

I check lite-server version is "lite-server@^2.2.0", and npm version 3.7.3, also i followed this accepted answer instructions but still facing same issue. Can anyone guide me how can fix it, I will appreciate. Thank You.

Community
  • 1
  • 1
Ayaz Ali Shah
  • 3,453
  • 9
  • 36
  • 68
  • 1
    In [Wrap up section](https://angular.io/docs/ts/latest/quickstart.html#!#build-and-run) different project structure than described in question. Please ensure that you have followed tutorial correctly. – Andriy Ivaneyko Jul 31 '16 at 08:00
  • 1
    You have to added bs-config.js file in the directory from which you run npm start. – Arpit Agarwal Jul 31 '16 at 08:00
  • @AndriyIvaneyko Thank you so much for the guide line, i didn't added the `bs-config` in the root. Your solution is worked for me Thank You +10. – Ayaz Ali Shah Jul 31 '16 at 08:08
  • @Mr.Developer Great that suggestion suits for you. Adding it as answer... – Andriy Ivaneyko Jul 31 '16 at 08:23

4 Answers4

2

In Wrap up section different project structure than described in question. Please ensure that you have followed tutorial correctly.

Andriy Ivaneyko
  • 20,639
  • 6
  • 60
  • 82
2

I see you are running lite-server 2.2.0; anyone else looking for help with this error should make sure they are running lite-server 2.0 or greater as that's when config file support was introduced.

Also, it can throw this error if there is a problem executing the bs-config.js, so check your config file for anything that could be erroring (including but not limited to syntax errors). For me I had forgotten to install the http-proxy-middleware so lite-server errored when it tried to execute the first line of my bs-config.js, which was var proxy = require('http-proxy-midleware');. An npm install --save-dev http-proxy-middleware fixed this error for me.

HT: this github issue.

Patrick
  • 5,970
  • 4
  • 24
  • 21
1

The reason that you have seen this warning message

Did not detect a bs-config.json or bs-config.js override file. Using lite-server defaults...

is probably that you have a definition in your package.json which describes what should happen once you trigger the npm start command, like:

"scripts": {
  "start": "tsc && concurrently \"tsc -w\" \"lite-server -c bs-config.json\" ",
...
}

Therefore, in short you need to either provide the bs-config.json file with the desired browser-sync configuration or modify the the above command.

Moreover, angular2 has now its famous quick-start example on github.

Evgeny Bobkin
  • 4,092
  • 2
  • 17
  • 21
0

I made this account specifically to second the answer made by Patrick on July 12th.
If your bs-config cannot be found it may be because you do not have the proper packages. In my case I had http-proxy-middleware, but was missing connect-history-api-fallback.

Make sure to check/install all the node packages used in your bs-config!

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
PatrickR
  • 13
  • 5