Still getting 'address already in use' using --inspect on typescript projects
See original GitHub issueBug report
When using NODE_OPTIONS='--inspect' next dev -p 1337 I’m still getting the error:
Starting inspector on 127.0.0.1:9229 failed: address already in use
Describe the bug
From what I understand, this bug should have been fixed as of https://github.com/zeit/next.js/pull/11041.
However, I still get the error:
npm run dev
> frontend@0.1.0 dev
> NODE_OPTIONS='--inspect' next dev -p 1337
Debugger listening on ws://127.0.0.1:9229/90c3d543-273f-492c-a8f6-bb3afd978e64
For help, see: https://nodejs.org/en/docs/inspector
[ wait ] starting the development server ...
[ info ] waiting on http://localhost:1337 ...
Starting inspector on 127.0.0.1:9229 failed: address already in use
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
- Edit
package.json’sdevscript:
"scripts": {
"dev": "NODE_OPTIONS='--inspect' next dev -p 1337",
...
},
"dependencies": {
"next": "9.3.4",
...
},
npm run devoryarn dev- See error
npm run dev
> frontend@0.1.0 dev
> NODE_OPTIONS='--inspect' next dev -p 1337
Debugger listening on ws://127.0.0.1:9229/90c3d543-273f-492c-a8f6-bb3afd978e64
For help, see: https://nodejs.org/en/docs/inspector
[ wait ] starting the development server ...
[ info ] waiting on http://localhost:1337 ...
Starting inspector on 127.0.0.1:9229 failed: address already in use
Expected behavior
Do not see address already in use error
Screenshots
If applicable, add screenshots to help explain your problem.
System information
- OS: macOS
- Browser (if applies) [e.g. chrome, safari]
- Version of Next.js:
9.3.4(also tried on9.3.5-canary.7) - Version of Node.js:
12.16.2
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Still getting 'address already in use' using --inspect ... - GitHub
Bug report When using NODE_OPTIONS='--inspect' next dev -p 1337 I'm still getting the error: Starting inspector on 127.0.0.1:9229 failed: ...
Read more >Nodemon Inspect address already in use when refresh with ...
I am debugging a node application in Visual Studio, so I have to attach create a new configuration in launch.json:
Read more >TypeScript debugging with Visual Studio Code
Visual Studio Code supports TypeScript debugging through its built-in Node.js ... file in a .vscode folder with default values detected in your project....
Read more >Starting inspector failed: address already in use
This means the address is already in use by another Node.js app and you may have forgotten to exit it. Solution§.
Read more >Create an ASP.NET Core app with TypeScript - Visual Studio
In this tutorial, you create an app using ASP. ... If you need to install the workload but already have Visual Studio, go...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

The conflicting port comes from
fork-ts-checker-webpack-pluginwhich starts its childprocess with the same environment variables as the host process. I opened https://github.com/TypeStrong/fork-ts-checker-webpack-plugin/pull/405 to get around this. You can also useto assign a random port. You’ll have to manually configure devtools with this port afterwards though.
edit:
Looks like
fork-ts-checker-webpack-pluginisn’t used duringnext devanymore, so this shouldn’t be a problem anymoreHad same issue, tried with 9.3.4 and 9.3.5-canary.7.
Ended up simply doing
node --inspect node_modules/next/dist/bin/next devwhich seems to do the trick for me