Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't run nodemon with --inspect flag #1832

Closed
Lukasz199312 opened this issue Jan 17, 2021 · 3 comments
Closed

Can't run nodemon with --inspect flag #1832

Lukasz199312 opened this issue Jan 17, 2021 · 3 comments

Comments

@Lukasz199312
Copy link

In package.json i have this "dev": "nodemon --inspect". and in nodemon.json

{
    "watch": ["src"],
    "ext": ".ts,.js",
    "ignore": [],
    "exec": "ts-node ./bin/www"
  }

with this configuration my server starts without debug mode.

@civts
Copy link

civts commented Apr 8, 2021

I may have had the same problem.
Ts-node has a particular syntax for passing the --inspect argument (link)

Try to:

  1. remove --inspect from your "dev": "nodemon --inspect"
  2. replace ts-node ./bin/www with node -r ts-node/register --inspect ./bin/www

This should fix the problem.

After that, you may also consider moving ./bin/www in the package.json script, ending up with the following:

  • nodemon.json:
    {
      "watch": ["src"],
      "ext": ".ts,.js",
      "ignore": [],
      "exec": "node -r ts-node/register --inspect"
    }
  • package.json:
    ...
    "scripts" : {
      "dev": "nodemon ./bin/www"
    }
    ...

@remy
Copy link
Owner

remy commented Apr 12, 2021

replace ts-node ./bin/www with node -r ts-node/register --inspect ./bin/www

☝️ this.

Thank you @civts 👍

@remy remy closed this as completed Apr 12, 2021
@bmaupin
Copy link

bmaupin commented Jan 31, 2022

I didn't have a separate nodemon.json folder, so I just appended -r ts-node/register --inspect to the end of my nodemon script in package.json, e.g.

    "dev": "nodemon --watch src src/index.ts -r ts-node/register --inspect",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants