I am getting the same issues as this issue: https://github.com/Microsoft/vscode/issues/27794
Version: 1.32.3
Commit: a3db5be9b5c6ba46bb7555ec5d60178ecc2eaae4
Date: 2019-03-14T23:38:49.842Z
Electron: 3.1.6
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Linux x64 4.10.0-32-generic
Steps to Reproduce:
Hitting me (changed)
[nodemon] files triggering change check: application/index.ts
[nodemon] matched rule: /home/karl/dev/a-vdgs-server/application/**/*
[nodemon] changes after filters (before/after): 1/1
[nodemon] restarting due to changes...
[nodemon] application/index.ts
[nodemon] starting `node -r ts-node/register --inspect=9229 ./application/server.ts`
[nodemon] spawning
[nodemon] child pid: 22626
Debugger listening on ws://127.0.0.1:9229/d3273c04-8fe5-4130-b02c-a6ee36bc6979
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
NODE_ENV is set to: development
Loaded config/development.json configuration file
Config lib initialized
Adding console log transport
2019-05-16T12:20:58.539Z info: Log lib initilized1
2019-05-16T12:20:58.555Z info: Websocket server started on port: 8081
2019-05-16T12:20:58.556Z debug: Connecting to MQTT broker on: mqtt://172.17.0.2
2019-05-16T12:20:58.595Z info: MQTT lib initilized
2019-05-16T12:20:58.606Z info: HTTP server running on: http://localhost:8080
2019-05-16T12:20:58.624Z debug: Connected to MQTT broker on: mqtt://172.17.0.2
2019-05-16T12:20:58.636Z debug: Presence!
2019-05-16T12:20:58.644Z debug: Hello mqtt
[nodemon] files triggering change check: application/index.ts
[nodemon] matched rule: /home/karl/dev/a-vdgs-server/application/**/*
[nodemon] changes after filters (before/after): 1/1
[nodemon] restarting due to changes...
[nodemon] application/index.ts
[nodemon] starting `node -r ts-node/register --inspect=9229 ./application/server.ts`
[nodemon] spawning
[nodemon] child pid: 22713
Debugger listening on ws://127.0.0.1:9229/785cd083-92e5-4c01-afd0-c945c2bcfa02
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
NODE_ENV is set to: development
Loaded config/development.json configuration file
Config lib initialized
Adding console log transport
2019-05-16T12:21:06.992Z info: Log lib initilized1
2019-05-16T12:21:07.004Z info: Websocket server started on port: 8081
2019-05-16T12:21:07.005Z debug: Connecting to MQTT broker on: mqtt://172.17.0.2
2019-05-16T12:21:07.038Z info: MQTT lib initilized
2019-05-16T12:21:07.043Z info: HTTP server running on: http://localhost:8080
2019-05-16T12:21:07.052Z debug: Connected to MQTT broker on: mqtt://172.17.0.2
2019-05-16T12:21:07.055Z debug: Presence!
2019-05-16T12:21:07.057Z debug: Hello mqtt
[nodemon] files triggering change check: application/index.ts
[nodemon] matched rule: /home/karl/dev/a-vdgs-server/application/**/*
[nodemon] changes after filters (before/after): 1/1
[nodemon] restarting due to changes...
[nodemon] application/index.ts
[nodemon] starting `node -r ts-node/register --inspect=9229 ./application/server.ts`
[nodemon] spawning
[nodemon] child pid: 22789
Starting inspector on 127.0.0.1:9229 failed: address already in use
[nodemon] app crashed - waiting for file changes before starting...
launch.json
{
"type": "node",
"request": "launch",
"name": "dev",
"runtimeExecutable": "nodemon",
"runtimeArgs": ["--config", "./nodemon.debug.json"],
"cwd": "${workspaceRoot}",
"restart": true,
"port": 9229,
"env": {
"NODE_ENV": "development"
},
"outputCapture": "std",
"console": "integratedTerminal"
},
nodemon.json
{
"watch": ["application"],
"ext": "ts",
"ignore": ["./**/*.spec.ts"],
"exec": "node -r ts-node/register --inspect=9229 ./application/server.ts",
"verbose": true
}
The behavior I see is that it randomly happens. My best guess is that the previous attached debugger hasn't finished closing down when the new one tries to start up on the same port. This is due to the "restart": true
. I don't know how this process works but from what I read it keeps track of the node process, but does it keep track of the previous debugger?
It sounds like the previous process is not shut down entirely when nodemon starts the new one. I don't think vscode would cause any issue here. Can you try debugging it with chrome devtools and see whether you get the same thing?
I've got the same issue:
{
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/trade.js",
"args": ["load", "test.errors.csv", "-y"]
}
]
}
Gives me:
/usr/local/bin/node --inspect-brk=24854 trade.js load test.errors.csv -y
Debugger listening on ws://127.0.0.1:24854/d4a6aef6-e461-43e6-9b49-0bef9eeca204
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
Starting inspector on 127.0.0.1:24854 failed: address already in use
Waiting for the debugger to disconnect...
{
"type": "node",
"request": "launch",
"name": "Next: Node",
"runtimeExecutable": "next",
"env": {
"NODE_OPTIONS": "--inspect"
},
"port": 9229,
"console": "integratedTerminal"
}
the port really dont matter, always says failed: "address already in use", and same with NPM runtime instead NODE
nextJS v8.0.3
node v12.8.1
npm v6.8.0
Debugger listening on ws://127.0.0.1:9229/828bbb76-a120-464b-9030-2555b1275b91
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
Waiting for the debugger to disconnect...
Debugger listening on ws://127.0.0.1:9229/3126f3b8-3a63-4f83-aa61-615d48701d6b
For help, see: https://nodejs.org/en/docs/inspector
projectecho-bookingflow@ dev c:\Users\Gianfranco\Desktop\echo
npm run generateLessImport && cross-env NODE_ENV=development node server.js --inspect
Starting inspector on 127.0.0.1:9229 failed: address already in use
I am also having this same issue, below is the environment details.
Version: 1.40.0-insider
Commit: d39e6b396c3ea364584126316a0fcf30f9cb378e
Date: 2019-11-05T01:58:38.382Z
Electron: 6.1.2
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Darwin x64 19.0.0
I have another instance of VS Code that does not encounter the issue here
Version: 1.39.2
Commit: 6ab598523be7a800d7f3eb4d92d7ab9a66069390
Date: 2019-10-15T15:33:00.827Z
Electron: 4.2.10
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Darwin x64 19.0.0
I have this issue on 1.41.0-insider
However, I get it after running updates (from 1.40.x-insider
) to try and fix it, so it's a fresh launch and was existent prior as well.
Then I run the following from the integrated Powershell terminal yarn start:win
The relevant script in package.json being:
"start:win": "set NODE_OPTIONS=\"--inspect\" && yarn verdaccio"
Edit:
I think I found the issue. I had launched a docker devcontainer with VSCode, and then my machine crashed.
VSCode launched before Docker came up, and that window was reverted to local FS.
Docker then came up, and launched the devcontainer, including the crashed debug port, it seems.
I found this with TCPView, and it was a quick solve from there.
Stopping the container resolved everything.
For anyone else having issues, I recommend checking what's actually on the port.
Also having the same issue here.
Run attach to process and show the error.
Look up the occupied port with lsof command:
lsof -i :9229
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
Code\x20H 20544 yukai 48u IPv4 0xxxxxxxxxxxxxxxxx 0t0 TCP localhost:9229 (LISTEN)
And found that extension host process is listening to the port 9229
Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-fork --type=extensionHost
It seems like this happens when there's an extension that was updated and is awaiting a restart.
I'm having this issue as well. It didn't occur until updating to VSCode version 1.40.1. When I find the process running on port 9229 and kill it, I get the following message in VSCode:
"Extension host terminated unexpectedly"
Is it possible that extension host is now running on port 9229 as of this version?
https://code.visualstudio.com/api/advanced-topics/extension-host
Same issue on 1.40.1. Occurs when debugger attempts to attach to process
Restarting vscode worked for me!
I'm getting this.. pretty frustrating. Sometimes I need to restart a couple of times to get it to clear.
As soon as I start vs code I opened a terminal and used 'netstat -b' and it shows python.exe was using port 9229. I had PlatformIO IDE enabled, tried disabling that and the port became free. Try going through your extensions and disable one at a time and check with netstat.
According to netstat -abno , vscode is using this process. It might be quite a bear to figure out which extension might be triggering it. Is there a way to set an abritrary port to use in the debug command line, as well as in launch.json ?
-- edit: there is: set "port": 9300 in launch.json, and swap "--inspect" on the node command line to "--inspect=9300"
works for me.
I tried to trace code in developer tool. I found that I might be triggered by this line:
https://github.com/microsoft/vscode/blob/4934a6f487b9ed6b99b900ae0710c7b452792e20/src/vs/workbench/contrib/extensions/electron-browser/extensionsAutoProfiler.ts#L46
Here is the related change:
https://github.com/microsoft/vscode/commit/0f2cda10da1e80088ad7908ac0f743c8f2132de0
Here is the call stack
ping @jrieken who authored the commit mentioned above and hopefully can help. We've had people running into this for Azure Functions scenarios as well. See https://github.com/MicrosoftDocs/azure-docs/issues/42379
cc @fiveisprime @chrisdias
Restart vscode didn't help, but I've found a workaround for me.
lsof -i:9229
to spot process occupying port 9229
com.docke 740 username 55u IPv6 0x500cc99aa74d1278 0t0 TCP *:9229 (LISTEN)
Code\x20H 88376 username 49u IPv4 0x511dd88ad7b5b676 0t0 TCP 127.0.0.1:9229 (LISTEN)
run kill 88376
vscode pop up an error : "Extension host terminated unexpectedly"
click Restart Extension
on the error popup
Start your debugger again and hopefully it would work
a little bit hassle but works for me =)
Btw, my environment:
Version: 1.40.1
Electron: 6.1.2
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Darwin x64 19.0.0
@FongX777 : thanks! That worked for me in my MacOS :)
Same happens to me too. Any guess on when we can expect an official patch/fix for this issue?
@FongX777 : thanks! That worked for me in my MacOS :)
Its works, but just temporary. Soon its back.
Since it is really difficult to understand what is going here, I suggest that we first agree on the recommended "nodemon" debug configuration:
{
"type": "node",
"request": "launch",
"name": "nodemon",
"runtimeExecutable": "nodemon",
"program": "${workspaceFolder}/test.js",
"restart": true,
"console": "integratedTerminal"
}
If you do not have nodemon
on the PATH, you can try something like this:
{
"type": "node",
"request": "launch",
"name": "nodemon",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/nodemon",
"program": "${workspaceFolder}/test.js",
"restart": true,
"console": "integratedTerminal"
}
Please note:
nodemon
. So you will have to kill nodemon
via Cntl-C from VS Code's integrated terminal (where it was started).Could you please try this approach and report back your experience. Thanks.
fwiw, @weinand i didn't use nodemon in my setup (although i will) ..
As clearly stated in the original description this issue is about a nodemon setup.
If you are not using nodemon, then please create a new issue.
I downgraded to VS Code 1.39.2 and the issue was gone. What was already reported above VS Code is openning the port 9229.
However, it's probably worth noting that it has absolutely nothing to do with nodemon :-S
As clearly stated in the original description this issue is about a nodemon setup.
If you are not using nodemon, then please create a new issue.
It's not a problem with VSCode I think. I am having this issue with nodemon on commandline.
➜ services: export NODE_OPTIONS='--inspect=5445'
➜ services: npx nodemon
Debugger listening on ws://127.0.0.1:5445/0ba1c149-b4b3-4aee-9c7e-45f36e98e688
For help, see: https://nodejs.org/en/docs/inspector
[nodemon] 1.19.4
[nodemon] to restart at any time, enter `rs`
[nodemon] watching dir(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `lerna run start`
Starting inspector on 127.0.0.1:5445 failed: address already in use
[nodemon] app crashed - waiting for file changes before starting...
@EricJizbaMSFT I've commented on the non-nodemon related issue #85328 and explained how we are planning to address this.
This issue is only for the nodemon related problems.
what i did are, kill extension host on help -> process list menu, then npm run debug, after that restart extension host. it worked, but really annoy me
with my case, kill the port and restart, works for me.
@weinand @ivanvpan
I had the same issue when was trying to run in Windows PowerShell next command:
> node --inspect-brk 4-bug.js
and Visual Code editor (Version 1.40.2 ) was opened.
After closing the editor, the command above began to work and even worked after I opened the editor again.
I've removed the .vscode/extensions.json
file and it seems ok. Three hours of work and the problem does not come back
thank you @FongX777
I had same issue here. I installed this extension: https://marketplace.visualstudio.com/items?itemName=niradler.kill-process
Just kill the ports are opened. It works like a charm!
Mine turned out to be:
/Library/Application Support/Adobe/Creative Cloud Libraries/CCLibrary.app/Contents/MacOS/../libs/node /Library/Application Support/Adobe/Creative Cloud Libraries/CCLibrary.app/Contents/MacOS/../js/server.js
based on
$ lsof -i -P | grep -i "listen" | grep 9229
node 461 testuser 33u IPv4 0x5920d268105ddc1f 0t0 TCP localhost:9229 (LISTEN)
$ ps auxwww | grep 461
testuser 461 0.4 0.7 5028304 55320 ?? S 30Mar20 1:40.33 /Library/Application Support/Adobe/Creative Cloud Libraries/CCLibrary.app/Contents/MacOS/../libs/node /Library/Application Support/Adobe/Creative Cloud Libraries/CCLibrary.app/Contents/MacOS/../js/server.js
Quitting Creative Cloud didn't stop the process, so I did a kill -9 to kill it.
In my case, to change the debug port, I included something similar to the following in my package.json:
"scripts": {
"start": "node ./bin/www",
"debug": "nodemon --inspect=9227 ./bin/www"
}
In my VSCode launch.json file I included something similar to the following in my launch.json:
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch via NPM",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run-script",
"debug"
],
"port": 9227,
"skipFiles": [
"<node_internals>/**"
]
},
{
"type": "node",
"request": "attach",
"name": "Node: Nodemon",
"processId": "${command:PickProcess}",
"restart": true,
"protocol": "inspector",
},
]
- lsof -i:9229
@Yukaii thank you so much
on my mac, debugger is not working
_debugging protractor (angular8)_
visual studio code version:
Version: 1.45.1
Commit: 5763d909d5f12fe19f215cbfdd29a91c0fa9208a
Date: 2020-05-14T08:33:47.663Z
Electron: 7.2.4
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Darwin x64 19.3.0
Error on debugger console
/usr/local/bin/node --inspect-brk=16749 node_modules/protractor/bin/protractor /Users/siva/Documents/aiq-ui-e2e/protractor-aiq-stg.conf.js
Debugger listening on ws://127.0.0.1:16749/d7d3518f-9e2f-4191-a22a-bf1f0c3f193a
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
[12:46:58] I/launcher - Running 1 instances of WebDriver
logger.js:158
[12:46:58] I/testLogger -
------------------------------------
logger.js:158
[12:46:58] I/testLogger - [chrome #01-0] PID: 60424
[chrome #01-0] Specs: /Users/siva/Documents/aiq-ui-e2e/src/modules/aiq/renewals/testCases/TC_001.e2e-spec.ts
[chrome #01-0]
[chrome #01-0] Starting inspector on 127.0.0.1:16749 failed: address already in use
logger.js:158
[12:46:58] I/testLogger -
logger.js:158
[12:46:58] E/launcher - Runner process exited unexpectedly with error code: 12
logger.js:158
[12:46:58] I/launcher - 1 instance(s) of WebDriver still running
logger.js:158
[12:46:58] I/testLogger -
------------------------------------
i found the solution for protractor (angular 8) debugging issue on visual studio code.
in _protractor.conf.js_ file, just mention only one file under specs array
exports.config = {
allScriptsTimeout: 300000,
specs: ["./src/**/*.e2e-spec.ts"], <------- here
capabilities: {
browserName: "chrome"
},
having one file in protractor conf is solving the problem and debubber is running successfully.
lsof -i:portNumber
kill -9 nodePID
helps
lsof -i :9229
kill -9 PIDNUMBER
Most helpful comment
Restart vscode didn't help, but I've found a workaround for me.
lsof -i:9229
to spot process occupying port9229
run
kill 88376
vscode pop up an error : "Extension host terminated unexpectedly"
click
Restart Extension
on the error popupStart your debugger again and hopefully it would work
a little bit hassle but works for me =)
Btw, my environment: