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

debug-wise args are not honored #531

Closed
Deilan opened this issue Feb 8, 2018 · 7 comments
Closed

debug-wise args are not honored #531

Deilan opened this issue Feb 8, 2018 · 7 comments

Comments

@Deilan
Copy link
Contributor

Deilan commented Feb 8, 2018

  • nodemon -v: 1.14.12
  • node -v: 8.9.4
  • ts-node -v: 4.1.0
  • Operating system/terminal environment: Windows 10 x64
  • Command you ran:

nodemon with the following nodemon.json:

{
    "verbose": true,
    "watch": [
        "src"
    ],
    "ext": "ts",
    "exec": "{{pwd}}/node_modules/.bin/ts-node ./src/index.ts --project ./tsconfig.development.json --inspect=5858 --inspect-brk"
}

Expected behaviour

--inspect=5858 --inspect-brk are passed to node and one can connect with debugger

Actual behaviour

--inspect=5858 --inspect-brk are not passed to node and one can't connect with debugger

terminal output:

[nodemon] 1.14.12
[nodemon] reading config .\nodemon.json
[nodemon] to restart at any time, enter `rs`
[nodemon] or send SIGHUP to 22156 to restart
[nodemon] watching: C:\Dev\node-typescript-vscode\src/**/*
[nodemon] watching extensions: ts
[nodemon] starting `C:\Dev\node-typescript-vscode/node_modules/.bin/ts-node ./src/index.ts --project ./tsconfig.development.json --inspect=5858 --inspect-brk`
[nodemon] spawning
[nodemon] child pid: 11272
[nodemon] watching 2 files

Steps to reproduce

  1. clone https://github.com/deilan-issues-samples/ts-node-issue-531
  2. yarn install or npm install
  3. yarn run serve:debug or npm run serve:debug
  4. launch Attach to nodemon VS Code debug configuration

@Deilan
Copy link
Contributor Author

Deilan commented Feb 8, 2018

Continuation of discussion of remy/nodemon#1250 and specifically remy/nodemon#1250 (comment).

@Deilan Deilan changed the title Pass unrecognized args along to node Pass debug-wise args along to node Feb 9, 2018
@Deilan Deilan changed the title Pass debug-wise args along to node debug-wise args are not passed to node Feb 9, 2018
Deilan added a commit to deilan-issues-samples/ts-node-issue-531 that referenced this issue Feb 9, 2018
@Deilan Deilan changed the title debug-wise args are not passed to node debug-wise args are not honored Feb 9, 2018
@iangregsondev
Copy link

Yes, I was going crazy for a file. I thought it was just me. Actually, I am also running nodemon but I took this out of the equation. So I execute

ts-node ./src/index.ts --inspect-brk=5860

And the same thing, it never waits for the debugger to be attached and prints out to the console the console.log that I made. I also had a breakpoint on the console.log.

@iangregsondev
Copy link

Sorry, probably worth mentioning that i am on a MAC

and

ts-node v4.1.0
node v8.9.1
typescript v2.7.1

@iangregsondev
Copy link

Ok, I think i have a workaround

You can execute it like this

node --inspect-brk=5858 --require ts-node/register ./src/index.ts

so you can create your nodemon.json file and do this, (create multiple nodemon.json files if you like - I have 1 for inspect and 1 for inspect-brk)

{
  "watch": ["src"],
  "ext": "ts",
  "ignore": ["src/**/*.spec.ts"],
  "exec": "node --inspect-brk=5858 --require ts-node/register ./src/index.ts"
}

Hope that helps.

So this trick here is not to run ts-node direct but to load via node.

@Deilan
Copy link
Contributor Author

Deilan commented Feb 10, 2018

@appsolutegeek Thanks for the workaround! Unfortunately it's not a complete solution because there's a case when third-party tools pass these args to the ending dynamically, e. g. Visual Studio Code debugger.

@blakeembrey
Copy link
Member

I'd recommend using node --require with flags. I'm going to deprecate this current usage, the hacks are just too taxing on me to maintain. Can you describe why that doesn't work for Visual Studio Code debugger?

@blakeembrey
Copy link
Member

Closing with #536. I recommend node -r ts-node/register for all advanced node.js use-cases and flags.

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

No branches or pull requests

3 participants