Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does the node inspector not start when I am using nodemon and ts-node?

People also ask

Does Nodemon use TS-node?

By default, nodemon uses the node CLI as an execution program for running JavaScript files; for TypeScript files, nodemon uses ts-node as the execution program instead.

How do I run a node inspect?

Using the Node. To connect to it, open up Google Chrome and enter about:inspect into the URL bar and press Enter. Afterward, you will be redirected to chrome://inspect/ and be presented with a list of available devices to debug. If successful, your screen should show something similar to the image below.

Which command is used to install node inspector?

Run a cmd, enter the folder and type npm install . Type npm install node-inspector again.


With ts-node 5.0.0 you no longer pass the --inspect flag the same way. The suggested way is node --inspect -r ts-node/register path/to/ts. For example:

nodemon --watch src/**/* -e ts,json --exec node --inspect-brk -r ts-node/register src/app.ts

see https://github.com/TypeStrong/ts-node/issues/537


Provide location and port to the inspect option like:

--inspect=0.0.0.0:9200

I just fixed this problem by writing nodemon.json file like this :

{
  "restartable": "rs",
  "ignore": [".git", "node_modules/**/node_modules"],
  "verbose": true,
  "execMap": { // [A]
    "ts": "node --require ts-node/register"
  },
  "watch": ["src/"],
  "env": {
    "NODE_ENV": "development"
  },
  "ext": "js,json,ts"
}

ref : https://dev.to/oieduardorabelo/nodejs-with-typescript-debug-inside-vscode-and-nodemon-23o7