2

I followed the tutorial here: vs-angular-tutorial

However after I added the chrome config to my launch.json file and hit f5 aI was met with a 'this site can't be reached' error instead of the webpage.

I did look into this a bit and if I run 'npm start' or 'ng serve' in the folder before hitting 'F5' it loads correctly.

Is this expected behaviour? There is no other way to jus tmake it work without running npm start or ng serve in an ongoing console window?

code.cycling
  • 1,246
  • 2
  • 15
  • 33
meds
  • 21,699
  • 37
  • 163
  • 314
  • It is expected behavior, without running `npm start` or `ng serve` the website doesn't have a server to run on. Using either of those commands starts the web server so it can be served up to the browser at the specified url. Running debugging only opens up (or attaches to) a Chrome window at that address; it will not start the web server. – Ben Black Nov 22 '17 at 14:27
  • Is there a way to automate starting the web server? I know when I run an angular visual studio project I don't have to run npm start so obviously it's automated.. – meds Nov 22 '17 at 22:01
  • 1
    I believe there is, I haven't tried it before but it looks like the launch configuration for debugging in `launch.json` includes a `preLaunchTask` property where you can supply the name of a task that exists in `tasks.json`. https://stackoverflow.com/questions/35327016/using-prelaunchtasks-and-naming-a-task-in-visual-studio-code might provide a good starting point for you. – Ben Black Nov 29 '17 at 16:05

0 Answers0