title: How to run Nodemon with TypeScript in debug mode in WebStorm
body: <p>I have a very basic Express server setup with NodeJS/Express + Nodemon.  I'm using WebStorm as my IDE.</p>
  <p>When running the debug/inspect script, my application is throwing a compile-time error. Following the instructions <a href="https://www.jetbrains.com/help/webstorm/running-and-debugging-node-js.html#nodemon" rel="nofollow noreferrer">here</a>, and cognizant of the post <a href="https://stackoverflow.com/questions/60359419/how-to-attach-to-nodemon-process-with-webstorm-and-typescript-setting">here</a>, my (simplified) <code>package.json</code> looks like this:</p>
  <pre class="lang-json prettyprint-override"><code>&quot;scripts&quot;: {
      &quot;test&quot;: &quot;echo \&quot;Error: no test specified\&quot; &amp;&amp; exit 1&quot;,
      &quot;dev&quot;: &quot;nodemon src/app.ts&quot;,
      &quot;debug&quot;: &quot;nodemon --inspect=127.0.0.1:9229 src/app.ts&quot;
    },
  &quot;devDependencies&quot;: {
      &quot;@types/express&quot;: &quot;^4.17.9&quot;,
      &quot;@types/node&quot;: &quot;^14.14.19&quot;,
      &quot;nodemon&quot;: &quot;^2.0.6&quot;,
      &quot;ts-node&quot;: &quot;^9.1.1&quot;,
      &quot;typescript&quot;: &quot;^4.1.3&quot;
    }
  </code></pre>
  <p>When I run <code>npm run debug</code> I receive the following error:</p>
  <p><a href="https://i.stack.imgur.com/RPKdH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RPKdH.png" alt="enter image description here" /></a></p>
  <p>I've also tried the following, all with the same result:</p>
  <ul>
  <li><code>&quot;debug&quot;: &quot;nodemon --inspect src/app.ts&quot;</code></li>
  <li><code>&quot;debug&quot;: &quot;nodemon --inspect=0.0.0.0:9229 src/app.ts&quot;</code></li>
  </ul>
  <p>Any ideas why this error is occurring?</p>
  <p>The command <code>npm run dev</code> does not generate an error.  Upon further investigation, nodemon automatically substitutes ts-node when targeting a <code>.ts</code> file.  Ts-node, in turn, <a href="https://github.com/TypeStrong/ts-node" rel="nofollow noreferrer">recommends</a> debugging by registering ts-node and running the server with the node command.</p>
  <blockquote>
  <p>If you need to use advanced node.js CLI arguments (e.g. --inspect),
  use them with <code>node -r ts-node/register</code> instead of the ts-node CLI.</p>
  </blockquote>