title: Debugging Angular application with Intellij Typescript debugger
body: <p>I am trying to debug an Angular application from Intellij 2021. So I'm using Intellij's Typescript and Javascript debuggers.</p>
  <p>My OS is Ubuntu. Node.js version v16.14.2.</p>
  <p>I'm following <a href="https://www.youtube.com/watch?v=b2gboBOoc88" rel="nofollow noreferrer">this video tutorial</a>. But I think that my project structure is different. In the video they seem to have two separate projects: a Java project for the back end, and an Angular project for the front end.</p>
  <p>In my case both ends are in one project: It's a Java project in which the Angular project is in a folder within the Java project. I start both projects by <code>sbt run</code> from the Java project root.</p>
  <p>And then Angular listens on port 4200, Java listens on port 9000.</p>
  <p>So for debugging the Angular project, I start both projects with <code>sbt run</code>. I do it because I want the Java project to start.</p>
  <p>According to the video, I now have to do in another terminal, from the Angular folder, <code>npm start</code>.</p>
  <p>But wait! That would try to start another Angular project on Angular's default port 4200, to which another Angular process is already listening. So I do instead: <code>npm start -- --port 4201</code>. And accordingly I change the URL in the intellij's JavaScript Debug configuration to <code>http://localhost:4201</code>.</p>
  <p>The Browser I chose in that configuration was Chrome, and I gave it the Chromium installation path.</p>
  <p>Now, according to the video, when <code>npm start -- --port 4201</code> is completed, I can start the debugger by clicking the green debug button.</p>
  <p>But it does not work.  After a few seconds I'm getting the message:</p>
  <blockquote>
  <p>Waiting for connection to localhost: 39807.</p>
  <p>Please ensure that the browser was started successfully with remote
  debugging port opened. Port cannot be opened if Chrome having the same
  User Data Directory is already launched.</p>
  </blockquote>
  <p><a href="https://i.stack.imgur.com/j0yIO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/j0yIO.png" alt="enter image description here" /></a></p>
  <p>I don't know where &quot;39807&quot; came from. In Intellij's <code>settings &gt; debugger &gt; built-in server</code> the port specified is a different number.</p>
  <p>Any idea how to fix it?</p>