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

--inspect doesn't work when used in NODE_OPTIONS #235

Closed
daveisfera opened this issue Oct 14, 2020 · 5 comments
Closed

--inspect doesn't work when used in NODE_OPTIONS #235

daveisfera opened this issue Oct 14, 2020 · 5 comments

Comments

@daveisfera
Copy link

daveisfera commented Oct 14, 2020

When running this command: NODE_OPTIONS="-r esm --inspect=0.0.0.0:9229" node_modules/.bin/node-dev test_inspect.js

I get this error:

Debugger listening on ws://0.0.0.0:9229/f3bc94ca-7c83-4cd3-bc97-60b332ed4f52
For help, see: https://nodejs.org/en/docs/inspector
@bjornstar
Copy link
Collaborator

Is there an error here? That looks like what I would expect to see when using --inspect.

@daveisfera
Copy link
Author

Sorry, forgot to include the 3rd line with the error:

Debugger listening on ws://0.0.0.0:9229/10a40133-57a2-4af7-9665-6d6c046acf3e
For help, see: https://nodejs.org/en/docs/inspector
Starting inspector on 0.0.0.0:9229 failed: address already in use

@bjornstar
Copy link
Collaborator

This is expected behavior, node-dev is it's own node process that will use NODE_OPTIONS and it will spawn another node process to run your script that will also use NODE_OPTIONS. Both of these processes will try to use the port that you've selected and it will fail as only one process can use the port.

@daveisfera
Copy link
Author

Oh interesting, so is there anyway to pass NODE_OPTIONS to the underlying node process then?

@bjornstar
Copy link
Collaborator

Any options that aren't for node-dev are passed on to the node process. You should be able to do node-dev --inspect=0.0.0.0:9229 test_inspect.js

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

2 participants