Vscode-js-debug: Debugger not stopping on breakpoints

Created on 26 Jul 2020  路  8Comments  路  Source: microsoft/vscode-js-debug

Hey! I'm having issues similar to https://github.com/microsoft/vscode/issues/103048, wanted to create a new issue so I'm not hijacking threads, it seemed like some people over there were having issues with NPM script arguments which is definitely unrelated for me.

Describe the bug
When the preview is enabled (now default), no breakpoints, debuggers, or initial breaks are hit. The program runs and exits with code 0 (if the node event loop is clear).

To Reproduce
Ubuntu 18.04, Using NVM globally, Node binary at 14.3.0, VSCode at 1.47.2, all built-in plugins enabled.

Code used is a single file to keep it insanely simple.

debugger;
console.log(1);
debugger;

Launch config, used just the default one and added a stopOnEntry and trace:

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Launch Program",
      "stopOnEntry": true,
      "skipFiles": [
        "<node_internals>/**"
      ],
      "program": "${workspaceFolder}/index.js",
      "trace": true
    }
  ]
}

Steps to reproduce the behavior:

  • Create a new folder, place the above JS in it with a launch config.
  • Run the launch program debug profile.
  • Observe no breakpoints are hit.

Log File

{"timestamp":1595779628477,"tag":"runtime.welcome","level":1,"message":"js-debug v1.47.5 started","metadata":{"os":"linux x64","nodeVersion":"v12.8.1","adapterVersion":"1.47.5"}}
{"tag":"dap.receive","timestamp":1595779628469,"metadata":{"connectionId":1,"message":{"command":"initialize","arguments":{"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"pwa-node","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-us","supportsProgressReporting":true},"type":"request","seq":1}},"level":0}
{"tag":"dap.send","timestamp":1595779628470,"metadata":{"connectionId":1,"message":{"seq":1,"type":"response","request_seq":1,"command":"initialize","success":true,"body":{"supportsConfigurationDoneRequest":true,"supportsFunctionBreakpoints":false,"supportsConditionalBreakpoints":true,"supportsHitConditionalBreakpoints":true,"supportsEvaluateForHovers":true,"exceptionBreakpointFilters":[{"filter":"caught","label":"Caught Exceptions","default":false},{"filter":"uncaught","label":"Uncaught Exceptions","default":false}],"supportsStepBack":false,"supportsSetVariable":true,"supportsRestartFrame":true,"supportsGotoTargetsRequest":false,"supportsStepInTargetsRequest":false,"supportsCompletionsRequest":true,"supportsModulesRequest":false,"additionalModuleColumns":[],"supportedChecksumAlgorithms":[],"supportsRestartRequest":true,"supportsExceptionOptions":false,"supportsValueFormattingOptions":true,"supportsExceptionInfoRequest":true,"supportTerminateDebuggee":false,"supportsDelayedStackTraceLoading":true,"supportsLoadedSourcesRequest":true,"supportsLogPoints":true,"supportsTerminateThreadsRequest":false,"supportsSetExpression":false,"supportsTerminateRequest":false,"completionTriggerCharacters":[".","[","\"","'"],"supportsBreakpointLocationsRequest":true,"supportsClipboardContext":true}}},"level":0}
{"tag":"dap.send","timestamp":1595779628470,"metadata":{"connectionId":1,"message":{"seq":2,"type":"event","event":"initialized","body":{}}},"level":0}
{"tag":"dap.receive","timestamp":1595779628474,"metadata":{"connectionId":1,"message":{"command":"launch","arguments":{"type":"pwa-node","request":"launch","name":"Launch Program","stopOnEntry":true,"skipFiles":["<node_internals>/**"],"program":"/home/jdelgado/repos/forks/test/index.js","trace":true,"cwd":"/home/jdelgado/repos/forks/test","logFilePath":"/home/jdelgado/.config/Code/logs/20200726T085802/exthost1/ms-vscode.node-debug/debugadapter-legacy.txt","__debuggablePatterns":["*.js","*.es6","*.jsx","*.mjs"],"__workspaceFolder":"/home/jdelgado/repos/forks/test","__sessionId":"e5094630-9ddd-46d7-af99-49b2c16b80bd"},"type":"request","seq":2}},"level":0}
{"tag":"dap.send","timestamp":1595779628475,"metadata":{"connectionId":1,"message":{"seq":3,"type":"event","event":"output","body":{"category":"telemetry","output":"js-debug/launch","data":{"type":"pwa-node","request":"launch","os":"linux x64","nodeVersion":"v12.8.1","adapterVersion":"1.47.5","parameters":"{\"type\":\"pwa-node\",\"name\":\"<string>\",\"request\":\"launch\",\"trace\":true,\"outputCapture\":\"console\",\"timeout\":10000,\"showAsyncStacks\":true,\"skipFiles\":[\"<string>\"],\"smartStep\":true,\"sourceMaps\":true,\"pauseForSourceMap\":false,\"resolveSourceMapLocations\":[\"<string>\",\"<string>\"],\"rootPath\":\"<string>\",\"outFiles\":[\"<string>\",\"<string>\"],\"sourceMapPathOverrides\":{\"webpack://?:*/*\":\"<string>\",\"webpack:///./~/*\":\"<string>\",\"meteor://馃捇app/*\":\"<string>\"},\"__workspaceFolder\":\"<string>\",\"__autoExpandGetters\":false,\"cwd\":\"<string>\",\"env\":{},\"envFile\":null,\"localRoot\":null,\"remoteRoot\":null,\"autoAttachChildProcesses\":true,\"runtimeSourcemapPausePatterns\":[],\"program\":\"<string>\",\"stopOnEntry\":true,\"console\":\"internalConsole\",\"restart\":false,\"args\":[],\"runtimeExecutable\":\"node\",\"runtimeVersion\":\"default\",\"runtimeArgs\":[],\"profileStartup\":false,\"logFilePath\":\"<string>\",\"__debuggablePatterns\":[\"<string>\",\"<string>\",\"<string>\",\"<string>\"],\"__sessionId\":\"<string>\"}"}}}},"level":0}
{"tag":"dap.send","timestamp":1595779628475,"metadata":{"connectionId":1,"message":{"seq":4,"type":"event","event":"output","body":{"category":"console","output":"Verbose logs are written to:\n/tmp/vscode-debugadapter-0.json.gz\n"}}},"level":0}
{"tag":"runtime.launch","timestamp":1595779628486,"message":"Using binary at","metadata":{"location":"/home/jdelgado/.nvm/versions/node/v14.3.0/bin/node","executable":"node"},"level":1}
{"tag":"dap.receive","timestamp":1595779628493,"metadata":{"connectionId":1,"message":{"command":"setBreakpoints","arguments":{"source":{"name":"index.js","path":"/home/jdelgado/repos/forks/test/index.js"},"lines":[1,2],"breakpoints":[{"line":1},{"line":2}],"sourceModified":false},"type":"request","seq":3}},"level":0}
{"tag":"dap.send","timestamp":1595779628494,"metadata":{"connectionId":1,"message":{"seq":5,"type":"response","request_seq":3,"command":"setBreakpoints","success":true,"body":{"breakpoints":[{"id":1,"verified":false,"message":"Unbound breakpoint"},{"id":2,"verified":false,"message":"Unbound breakpoint"}]}}},"level":0}
{"tag":"runtime.launch","timestamp":1595779628494,"message":"Discovered version","metadata":{"version":"v14.3.0"},"level":1}
{"tag":"dap.send","timestamp":1595779628502,"metadata":{"connectionId":1,"message":{"seq":6,"type":"event","event":"output","body":{"category":"console","output":"/home/jdelgado/.nvm/versions/node/v14.3.0/bin/node /home/jdelgado/repos/forks/test/index.js"}}},"level":0}
{"tag":"runtime.launch","timestamp":1595779628509,"message":"Launched successfully","metadata":{"name":"v"},"level":1}
{"tag":"dap.send","timestamp":1595779628509,"metadata":{"connectionId":1,"message":{"seq":7,"type":"response","request_seq":2,"command":"launch","success":true,"body":{}}},"level":0}
{"tag":"dap.send","timestamp":1595779628531,"metadata":{"connectionId":1,"message":{"seq":8,"type":"event","event":"output","body":{"category":"stderr","output":""}}},"level":0}
{"tag":"dap.send","timestamp":1595779628531,"metadata":{"connectionId":1,"message":{"seq":9,"type":"event","event":"output","body":{"category":"stderr","output":"Process exited with code 0\r\n"}}},"level":0}
{"tag":"dap.send","timestamp":1595779628531,"metadata":{"connectionId":1,"message":{"seq":10,"type":"event","event":"terminated","body":{}}},"level":0}
{"tag":"dap.receive","timestamp":1595779628539,"metadata":{"connectionId":1,"message":{"command":"setExceptionBreakpoints","arguments":{"filters":[]},"type":"request","seq":4}},"level":0}
{"tag":"dap.send","timestamp":1595779628539,"metadata":{"connectionId":1,"message":{"seq":11,"type":"response","request_seq":4,"command":"setExceptionBreakpoints","success":true,"body":{}}},"level":0}
{"tag":"dap.receive","timestamp":1595779628558,"metadata":{"connectionId":1,"message":{"command":"loadedSources","type":"request","seq":5}},"level":0}
{"tag":"dap.send","timestamp":1595779628558,"metadata":{"connectionId":1,"message":{"seq":12,"type":"response","request_seq":5,"command":"loadedSources","success":true,"body":{"sources":[]}}},"level":0}
{"tag":"dap.receive","timestamp":1595779628562,"metadata":{"connectionId":1,"message":{"command":"disconnect","arguments":{"restart":false},"type":"request","seq":6}},"level":0}
{"tag":"dap.send","timestamp":1595779628563,"metadata":{"connectionId":1,"message":{"seq":13,"type":"response","request_seq":6,"command":"disconnect","success":true,"body":{}}},"level":0}
{"tag":"dap.receive","timestamp":1595779628566,"metadata":{"connectionId":1,"message":{"command":"configurationDone","type":"request","seq":7}},"level":0}
{"tag":"dap.send","timestamp":1595779628566,"metadata":{"connectionId":1,"message":{"seq":14,"type":"response","request_seq":7,"command":"configurationDone","success":true,"body":{}}},"level":0}
{"tag":"dap.receive","timestamp":1595779628567,"metadata":{"connectionId":1,"message":{"command":"breakpointLocations","arguments":{"source":{"name":"index.js","path":"/home/jdelgado/repos/forks/test/index.js"},"line":1},"type":"request","seq":8}},"level":0}
{"tag":"dap.send","timestamp":1595779628567,"metadata":{"connectionId":1,"message":{"seq":15,"type":"response","request_seq":8,"command":"breakpointLocations","success":true,"body":{"breakpoints":[]}}},"level":0}
{"tag":"dap.receive","timestamp":1595779628567,"metadata":{"connectionId":1,"message":{"command":"breakpointLocations","arguments":{"source":{"name":"index.js","path":"/home/jdelgado/repos/forks/test/index.js"},"line":2},"type":"request","seq":9}},"level":0}
{"tag":"dap.send","timestamp":1595779628567,"metadata":{"connectionId":1,"message":{"seq":16,"type":"response","request_seq":9,"command":"breakpointLocations","success":true,"body":{"breakpoints":[]}}},"level":0}

VS Code Version: 1.47.2

Additional context

  • Disabling the preview causes everything to work as expected. Definitely related to the new version.
  • I am not using NPM scripts etc, this is directly debugging a file via profile.
  • Attaching to a script and not launching it is still working. My launch configuration for that project:
{
  "type": "node",
  "request": "attach",
  "name": "Docker",
  "address": "localhost",
  "port": 9230,
  "restart": true,
  "localRoot": "${workspaceFolder}",
  "remoteRoot": "/app"
},
  • I noticed when looking into other submitted trace files that I'm missing an "args" array for the "command":"launch" line. I'm unsure if that is related. I'm just using the default launch configuration which the readme specified should work, so I'm not confident in that assessment.

Please let me know if I can provide any further information or test an assumed fix. Thanks for all the work you guys/gals put into projects like this!

bug

Most helpful comment

That is _very_ weird. Thank you for digging around in it. I've opened a bug on Node to make sure they're aware of it; since it seems installation-dependent, we can't be sure whether it's fixed on recent versions.

All 8 comments

Can you do two things?

  1. See if this happens with the nightly build
  2. If so, it looks like the program doesn't even try to import the bootloader or enter dev mode. What happens if you:

    1. Add console: "integratedTerminal" to your launch.json (this might fix things by itself...)

    2. Add console.log(process.env.NODE_OPTIONS, process.env.VSCODE_INSPECTOR_OPTIONS) to your script

  1. I tried the nightly build. I got the error "Can't find Node.js binary "node". Make sure Node.js is installed and in your PATH, or set the "runtimeExecutable" in your launch.json using the same launch config as above. Setting "runtimeExecutable": "/home/jdelgado/.nvm/versions/node/v14.3.0/bin/node", resolved it. I doubt this is related but just wanted to report it. I assume this is some OS-level NVM thing, I could still do which node successfully in zsh and bash.

EDIT: When I reverted back to the non-nightly, I had the same problem with the executable, so definitely not related to this specific issue.

Once I got past that, I got the same result on the nightly version, it just didn't specify the exit code. Here is the trace:

{"timestamp":1595791356953,"tag":"runtime.welcome","level":1,"message":"js-debug-nightly v2020.7.2417 started","metadata":{"os":"linux x64","nodeVersion":"v12.8.1","adapterVersion":"2020.7.2417"}}
{"tag":"dap.receive","timestamp":1595791356945,"metadata":{"connectionId":0,"message":{"command":"initialize","arguments":{"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"pwa-node","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-us","supportsProgressReporting":true},"type":"request","seq":1}},"level":0}
{"tag":"dap.send","timestamp":1595791356946,"metadata":{"connectionId":0,"message":{"seq":1,"type":"response","request_seq":1,"command":"initialize","success":true,"body":{"supportsConfigurationDoneRequest":true,"supportsFunctionBreakpoints":false,"supportsConditionalBreakpoints":true,"supportsHitConditionalBreakpoints":true,"supportsEvaluateForHovers":true,"exceptionBreakpointFilters":[{"filter":"caught","label":"Caught Exceptions","default":false},{"filter":"uncaught","label":"Uncaught Exceptions","default":false}],"supportsStepBack":false,"supportsSetVariable":true,"supportsRestartFrame":true,"supportsGotoTargetsRequest":false,"supportsStepInTargetsRequest":false,"supportsCompletionsRequest":true,"supportsModulesRequest":false,"additionalModuleColumns":[],"supportedChecksumAlgorithms":[],"supportsRestartRequest":true,"supportsExceptionOptions":false,"supportsValueFormattingOptions":true,"supportsExceptionInfoRequest":true,"supportTerminateDebuggee":false,"supportsDelayedStackTraceLoading":true,"supportsLoadedSourcesRequest":true,"supportsLogPoints":true,"supportsTerminateThreadsRequest":false,"supportsSetExpression":false,"supportsTerminateRequest":false,"completionTriggerCharacters":[".","[","\"","'"],"supportsBreakpointLocationsRequest":true,"supportsClipboardContext":true}}},"level":0}
{"tag":"dap.send","timestamp":1595791356947,"metadata":{"connectionId":0,"message":{"seq":2,"type":"event","event":"initialized","body":{}}},"level":0}
{"tag":"dap.receive","timestamp":1595791356948,"metadata":{"connectionId":0,"message":{"command":"launch","arguments":{"type":"pwa-node","request":"launch","name":"Launch Program","stopOnEntry":true,"skipFiles":["<node_internals>/**"],"runtimeExecutable":"/home/jdelgado/.nvm/versions/node/v14.3.0/bin/node","program":"/home/jdelgado/repos/forks/test/index.js","trace":true,"cwd":"/home/jdelgado/repos/forks/test","logFilePath":"/home/jdelgado/.config/Code/logs/20200726T084227/exthost9/ms-vscode.node-debug/debugadapter-legacy.txt","__debuggablePatterns":["*.js","*.es6","*.jsx","*.mjs"],"__workspaceFolder":"/home/jdelgado/repos/forks/test","__sessionId":"5c4eb5d2-6ab6-4b34-b73b-9fb5e4da2d32"},"type":"request","seq":2}},"level":0}
{"tag":"dap.send","timestamp":1595791356949,"metadata":{"connectionId":0,"message":{"seq":3,"type":"event","event":"output","body":{"category":"console","output":"Note: Using the \"preview\" debug extension\n"}}},"level":0}
{"tag":"dap.send","timestamp":1595791356949,"metadata":{"connectionId":0,"message":{"seq":4,"type":"event","event":"output","body":{"category":"telemetry","output":"js-debug/launch","data":{"type":"pwa-node","request":"launch","os":"linux x64","nodeVersion":"v12.8.1","adapterVersion":"2020.7.2417","parameters":"{\"type\":\"pwa-node\",\"name\":\"<string>\",\"request\":\"launch\",\"trace\":true,\"outputCapture\":\"console\",\"timeout\":10000,\"timeouts\":{},\"showAsyncStacks\":true,\"skipFiles\":[\"<string>\"],\"smartStep\":true,\"sourceMaps\":true,\"pauseForSourceMap\":false,\"resolveSourceMapLocations\":[\"<string>\",\"<string>\"],\"rootPath\":\"<string>\",\"outFiles\":[\"<string>\",\"<string>\"],\"sourceMapPathOverrides\":{\"webpack://?:*/*\":\"<string>\",\"webpack:///./~/*\":\"<string>\",\"meteor://馃捇app/*\":\"<string>\"},\"enableContentValidation\":true,\"__workspaceFolder\":\"<string>\",\"__autoExpandGetters\":false,\"cwd\":\"<string>\",\"env\":{},\"envFile\":null,\"localRoot\":null,\"remoteRoot\":null,\"autoAttachChildProcesses\":true,\"runtimeSourcemapPausePatterns\":[],\"program\":\"<string>\",\"stopOnEntry\":true,\"console\":\"internalConsole\",\"restart\":false,\"args\":[],\"runtimeExecutable\":\"<string>\",\"runtimeVersion\":\"default\",\"runtimeArgs\":[],\"profileStartup\":false,\"attachSimplePort\":null,\"logFilePath\":\"<string>\",\"__debuggablePatterns\":[\"<string>\",\"<string>\",\"<string>\",\"<string>\"],\"__sessionId\":\"<string>\"}"}}}},"level":0}
{"tag":"dap.send","timestamp":1595791356950,"metadata":{"connectionId":0,"message":{"seq":5,"type":"event","event":"output","body":{"category":"console","output":"Verbose logs are written to:\n/tmp/vscode-debugadapter-8.json.gz\n"}}},"level":0}
{"tag":"runtime.launch","timestamp":1595791356954,"message":"Using binary at","metadata":{"location":"/home/jdelgado/.nvm/versions/node/v14.3.0/bin/node","executable":"/home/jdelgado/.nvm/versions/node/v14.3.0/bin/node"},"level":1}
{"tag":"dap.receive","timestamp":1595791356966,"metadata":{"connectionId":0,"message":{"command":"setBreakpoints","arguments":{"source":{"name":"index.js","path":"/home/jdelgado/repos/forks/test/index.js"},"lines":[1,2],"breakpoints":[{"line":1},{"line":2}],"sourceModified":false},"type":"request","seq":3}},"level":0}
{"tag":"dap.send","timestamp":1595791356966,"metadata":{"connectionId":0,"message":{"seq":6,"type":"response","request_seq":3,"command":"setBreakpoints","success":true,"body":{"breakpoints":[{"id":1,"verified":false,"message":"Unbound breakpoint"},{"id":2,"verified":false,"message":"Unbound breakpoint"}]}}},"level":0}
{"tag":"runtime.launch","timestamp":1595791356967,"message":"Discovered version","metadata":{"version":"v14.3.0"},"level":1}
{"tag":"dap.send","timestamp":1595791356978,"metadata":{"connectionId":0,"message":{"seq":7,"type":"event","event":"output","body":{"category":"console","output":"/home/jdelgado/.nvm/versions/node/v14.3.0/bin/node ./index.js"}}},"level":0}
{"tag":"runtime.launch","timestamp":1595791356989,"message":"Launched successfully","metadata":{"name":"S"},"level":1}
{"tag":"dap.send","timestamp":1595791356989,"metadata":{"connectionId":0,"message":{"seq":8,"type":"response","request_seq":2,"command":"launch","success":true,"body":{}}},"level":0}
{"tag":"dap.receive","timestamp":1595791357010,"metadata":{"connectionId":0,"message":{"command":"setExceptionBreakpoints","arguments":{"filters":[]},"type":"request","seq":4}},"level":0}
{"tag":"dap.send","timestamp":1595791357011,"metadata":{"connectionId":0,"message":{"seq":9,"type":"response","request_seq":4,"command":"setExceptionBreakpoints","success":true,"body":{}}},"level":0}
{"tag":"dap.send","timestamp":1595791357011,"metadata":{"connectionId":0,"message":{"seq":10,"type":"event","event":"terminated","body":{}}},"level":0}
{"tag":"dap.receive","timestamp":1595791357024,"metadata":{"connectionId":0,"message":{"command":"loadedSources","type":"request","seq":5}},"level":0}
{"tag":"dap.send","timestamp":1595791357024,"metadata":{"connectionId":0,"message":{"seq":11,"type":"response","request_seq":5,"command":"loadedSources","success":true,"body":{"sources":[]}}},"level":0}
{"tag":"dap.receive","timestamp":1595791357027,"metadata":{"connectionId":0,"message":{"command":"configurationDone","type":"request","seq":6}},"level":0}
{"tag":"dap.send","timestamp":1595791357027,"metadata":{"connectionId":0,"message":{"seq":12,"type":"response","request_seq":6,"command":"configurationDone","success":true,"body":{}}},"level":0}
{"tag":"dap.receive","timestamp":1595791357029,"metadata":{"connectionId":0,"message":{"command":"disconnect","arguments":{"restart":false},"type":"request","seq":7}},"level":0}
{"tag":"dap.send","timestamp":1595791357030,"metadata":{"connectionId":0,"message":{"seq":13,"type":"response","request_seq":7,"command":"disconnect","success":true,"body":{}}},"level":0}
{"tag":"dap.receive","timestamp":1595791357032,"metadata":{"connectionId":0,"message":{"command":"threads","type":"request","seq":8}},"level":0}
{"tag":"dap.send","timestamp":1595791357032,"metadata":{"connectionId":0,"message":{"seq":14,"type":"response","request_seq":8,"command":"threads","success":true,"body":{"threads":[]}}},"level":0}

  1. I added both, the result:
repos/forks/test 位  env 'NODE_OPTIONS=--require "/home/jdelgado/.vscode/extensions/ms-vscode.js-debug-nightly-2020.7.2417/src/bootloader.bundle.js" ' 'VSCODE_INSPECTOR_OPTIONS={"inspectorIpc":"/tmp/node-cdp.1308-5.sock","deferredMode":false,"waitForDebugger":"","onlyEntrypoint":false,"fileCallback":"/tmp/node-debug-callback-fa51b2746b17491f"}' /home/jdelgado/.nvm/versions/node/v14.3.0/bin/node ./index.js 
--require "/home/jdelgado/.vscode/extensions/ms-vscode.js-debug-nightly-2020.7.2417/src/bootloader.bundle.js"  {"inspectorIpc":"/tmp/node-cdp.1308-5.sock","deferredMode":false,"waitForDebugger":"","onlyEntrypoint":false,"fileCallback":"/tmp/node-debug-callback-fa51b2746b17491f"}
1

Where "1" is the program's test console.log.

Okay, thanks. For some reason the environment variables then don't seem to be applying on your system. In the console, you can see the command that tries to set up. I recommend poking around with your system and configuration to see why this is the case.

Yeah, I can totally dive in more, I'd love to get this solved.

Could you expand a little bit on what environment variables you don't see being passed? Prior to posting here, I looked at the output and came to the conclusion that the env variables were being passed properly.

I see the input command setting the environment to (line seperated for ease of reading):

env 'NODE_OPTIONS=--require "/home/jdelgado/.vscode/extensions/ms-vscode.js-debug-nightly-2020.7.2417/src/bootloader.bundle.js"'
'VSCODE_INSPECTOR_OPTIONS={"inspectorIpc":"/tmp/node-cdp.1308-5.sock","deferredMode":false,"waitForDebugger":"","onlyEntrypoint":false,"fileCallback":"/tmp/node-debug-callback-fa51b2746b17491f"}'

And the console log outputs

--require "/home/jdelgado/.vscode/extensions/ms-vscode.js-debug-nightly-2020.7.2417/src/bootloader.bundle.js"
{"inspectorIpc":"/tmp/node-cdp.1308-5.sock","deferredMode":false,"waitForDebugger":"","onlyEntrypoint":false,"fileCallback":"/tmp/node-debug-callback-fa51b2746b17491f"}

Thanks again for the help!

Ah, okay, thanks, I misread the log file.

Can you try installing this version of the extension (download then run the "Install from VSIX" command) and (still running with console: integratedTerminal) share the resulting output?

I tried that version and it resulted in the same console output.

I then started to just step through everything. I made sure the file referenced in the require existed and just for grins I modified the file to do a console.log just to make sure it was actually being imported. After modifying the file, I noticed it wasn't being executed properly. I did nvm use 10 and tried the same command again and it worked as expected. I downloaded and tried each major between 10 and 14 as well as some minors around 14.3, all were executing the script properly.

Where 3 is the "require script" and 1 is the normal output.

repos/forks/test 位 nvm install 14.6
Downloading and installing node v14.6.0...
Downloading https://nodejs.org/dist/v14.6.0/node-v14.6.0-linux-x64.tar.xz...
######################################################################################################################################################################################################################################################### 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v14.6.0 (npm v6.14.6)
repos/forks/test took 4s 位 nvm use 14.6
Now using node v14.6.0 (npm v6.14.6)
repos/forks/test 位 env 'NODE_OPTIONS=--require /home/jdelgado/repos/forks/test/t.js' node index.js
3
--require /home/jdelgado/repos/forks/test/t.js undefined
1
repos/forks/test 位 nvm use 14.3
Now using node v14.3.0 (npm v6.14.5)
repos/forks/test 位 env 'NODE_OPTIONS=--require /home/jdelgado/repos/forks/test/t.js' node index.js
--require /home/jdelgado/repos/forks/test/t.js undefined
1
repos/forks/test 位 nvm install 14.4
Downloading and installing node v14.4.0...
Downloading https://nodejs.org/dist/v14.4.0/node-v14.4.0-linux-x64.tar.xz...
######################################################################################################################################################################################################################################################### 100.0%
Computing checksum with sha256sum
Checksums matched!
nvNow using node v14.4.0 (npm v6.14.5)
repos/forks/test took 4s 位 nvm use 14.4
^[[ANow using node v14.4.0 (npm v6.14.5)
repos/forks/test 位 nvm install 14.4
repos/forks/test 位 env 'NODE_OPTIONS=--require /home/jdelgado/repos/forks/test/t.js' node index.js
3
--require /home/jdelgado/repos/forks/test/t.js undefined
1

I then did an nvm uninstall and nvm install of 14.3 and now everything is working as expected. I don't quite know how I got in that state, but sharing the story in case this same issue is happening elsewhere. Might also be a good debug step in the future if you have people manually edit that file or perhaps even trace that the file was loaded in the program output (if trace is enabled).

Thanks again for the help!

I'm going to go ahead and mark as closed, happy to follow up if you have any further questions on this, though!

That is _very_ weird. Thank you for digging around in it. I've opened a bug on Node to make sure they're aware of it; since it seems installation-dependent, we can't be sure whether it's fixed on recent versions.

Was this page helpful?
0 / 5 - 0 ratings