Skip to content

Debugging + cluster.fork in vscode results in an error Unknown or unexpected option:--inspect-port #2125

Description

@KingLiLi

file:app.ts
code:
if (cluster.isPrimary) {
cluster.fork()
}else{
console.log("start")
}

The above code is run with the command: node-ts app.ts. It works well.
But if you debug it through vscode and start it with cluster.fork(). node-ts will report an error:
Unknown or unexpected option:--inspect-port

I tried to modify the source code: \node_modules\ts-node\node_modules\arg\index.js
Add continue on line 87;
Delete: const err = new Error(' Unknown or unexpected option: ${originalArgName} ');

The program can run normally.

I think this problem needs to be fixed. Because node-ts can run in a variety of programs. Then other programs may have additional options that we have no control over.
I want to add an option: Turn on the option to ignore unknown items

Activity

  1. KingLiLi commented on Jun 21, 2024

    @KingLiLi
    Author

    Note: This problem occurs only when vscode debugging is enabled and cluster.fork is called.
    No matter what. I think it is necessary to add an option that ignores unknown options and does not report errors.
    Hope to think about it!

  2. KingLiLi commented on Jun 21, 2024

    @KingLiLi
    Author

    I can bring up a pr if you want

  3. polyglot-k commented on Jun 22, 2024

    @polyglot-k

    @KingLiLi I can help u! explain the situation more plz!

  4. KingLiLi commented on Sep 5, 2024

    @KingLiLi
    Author

    @KingLiLi I can help u! explain the situation more plz!

    The duplicate code is given. I'm not using cluster at this point. Deploy a multi-core parameter alternative using pm2.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions