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

NodeJS code has a strange problem when debugging with the npm run dev command! And there is also a strange phenomenon in Remote SSH! #236585

Open
baiej214 opened this issue Dec 19, 2024 · 8 comments
Assignees
Labels
info-needed Issue requires more information from poster

Comments

@baiej214
Copy link

baiej214 commented Dec 19, 2024

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version:
    版本: 1.96.1 (system setup)
    提交: 42b2661
    日期: 2024-12-17T17:50:05.206Z
    Electron: 32.2.6
    ElectronBuildId: 10629634
    Chromium: 128.0.6613.186
    Node.js: 20.18.1
    V8: 12.8.374.38-electron.0

  • OS Version:
    OS: Windows_NT x64 10.0.17763
    Version: Windows Server 2019 Datacenter
    Version number: 1809
    Installation Date: 11/7/2024
    OS Build : 17763.6532

  • File structure and all code
    Image

Steps to Reproduce:

  1. I don't have any third-party plugins installed, except for the Chinese language pack.
  2. In the above configuration, press F5 to debug.
  3. The "terminal" prints out npm run dev and waits for about 15 seconds before continuing to print the result (123).
  4. And there is no output in the debug console, and the breakpoint is invalid, and the code cannot be debugged.
  5. After pressing Shift+F5 to stop debugging, manually enter "npm run dev" in the terminal, press the enter key, basically no waiting, and the content will be output soon.
  6. Manually enter "node index.js" in the terminal, press the enter key, and "123" will be output instantly.
  7. The same code and vscode will work fine on another Windows 11.
  8. I use vscode's remote ssh plugin from local Windows 11 to remote this test project, and the same problem occurs. But it's fine to run local code, and it's okay to run other servers remotely.
  9. There is also a phenomenon that when I remotely this server from a local computer, I have to add VSCode's remote. SSH.useExecServer setting is turned off in order to link the remote normally, otherwise it will never be able to connect, but it does not need to be turned off when connecting to other servers.Image

I really don't know what went wrong. Please help take a look, thank you!

@vs-code-engineering vs-code-engineering bot added *english-please Issue not using English and removed *english-please Issue not using English labels Dec 19, 2024
@baiej214 baiej214 changed the title nodejs代码在使用npm run dev命令调试的时候,出现了奇怪的问题!并且remote ssh也出现了奇怪的现象! NodeJS code has a strange problem when debugging with the npm run dev command! And there is also a strange phenomenon in Remote SSH! Dec 19, 2024
@roblourens
Copy link
Member

/jsDebugLogs

@vs-code-engineering vs-code-engineering bot added the info-needed Issue requires more information from poster label Dec 19, 2024
Copy link

Please collect trace logs using the following instructions:

If you're able to, add "trace": true to your launch.json and reproduce the issue. The location of the log file on your disk will be written to the Debug Console. Share that with us.

⚠️ This log file will not contain source code, but will contain file paths. You can drop it into https://microsoft.github.io/vscode-pwa-analyzer/index.html to see what it contains. If you'd rather not share the log publicly, you can email it to connor@xbox.com

@roblourens
Copy link
Member

Also, could you try connecting with useExecServer enabled, and share the log from the Remote-SSH output channel?

@roblourens roblourens assigned connor4312 and unassigned roblourens Dec 19, 2024
@baiej214
Copy link
Author

Also, could you try connecting with useExecServer enabled, and share the log from the Remote-SSH output channel?

Hello roblourens, here is the output log of Remote-SSH when useExecServer is enabled:

[17:06:03.068] Log Level: 2
[17:06:03.082] VS Code version: 1.96.2
[17:06:03.082] Remote-SSH version: remote-ssh@0.116.1
[17:06:03.082] win32 x64
[17:06:03.084] SSH Resolver called for "ssh-remote+金达", attempt 1
[17:06:03.085] remote.SSH.useLocalServer = false
[17:06:03.085] remote.SSH.useExecServer = true
[17:06:03.085] remote.SSH.showLoginTerminal = false
[17:06:03.085] remote.SSH.remotePlatform = {"192.168.1.51":"linux","192.168.137.5":"linux","192.168.1.238":"windows","192.168.1.223":"windows","192.168.137.223":"windows","10.10.10.55":"windows","10.10.10.100":"linux","minGServer":"windows","miniGServer":"windows","47.117.121.221":"windows","马家凹":"windows","南山":"windows","金达":"windows"}
[17:06:03.085] remote.SSH.path = undefined
[17:06:03.085] remote.SSH.configFile = undefined
[17:06:03.085] remote.SSH.useFlock = true
[17:06:03.085] remote.SSH.lockfilesInTmp = false
[17:06:03.085] remote.SSH.localServerDownload = auto
[17:06:03.086] remote.SSH.remoteServerListenOnSocket = false
[17:06:03.086] remote.SSH.defaultExtensions = []
[17:06:03.086] remote.SSH.loglevel = 2
[17:06:03.086] remote.SSH.enableDynamicForwarding = true
[17:06:03.086] remote.SSH.enableRemoteCommand = false
[17:06:03.086] remote.SSH.serverPickPortsFromRange = {}
[17:06:03.086] remote.SSH.serverInstallPath = {}
[17:06:03.086] remote.SSH.permitPtyAllocation = false
[17:06:03.086] remote.SSH.preferredLocalPortRange = undefined
[17:06:03.086] remote.SSH.useCurlAndWgetConfigurationFiles = false
[17:06:03.086] remote.SSH.experimental.chat = false
[17:06:03.086] remote.SSH.experimental.enhancedSessionLogs = false
[17:06:03.095] SSH Resolver called for host: 金达
[17:06:03.095] Setting up SSH remote "金达"
[17:06:03.101] Using commit id "fabdb6a30b49f79a7aba0f2ad9df9b399473380f" and quality "stable" for server
[17:06:03.105] Script variables:
 {
  "ExitCode.0": "OK",
  "ExitCode.64": "LinuxPrereqs",
  "ExitCode.65": "ProxyAuthenticationRequired",
  "ExitCode.128": "UnparsableOutput",
  "ExitCode.129": "EmptyOutput",
  "ExitCode.131": "UnhandledResolverExitCode",
  "ExitCode.132": "OfflineError",
  "ExitCode.133": "SshInstall",
  "ExitCode.134": "FindLocalPort",
  "ExitCode.135": "Timeout",
  "ExitCode.136": "ExhaustedRetries",
  "ExitCode.137": "PermissionDenied",
  "ExitCode.138": "MitmPortForwardingDisabled",
  "ExitCode.139": "Canceled",
  "ExitCode.140": "BadLocalDownloadRequest",
  "ExitCode.141": "LocalDownloadFailed",
  "ExitCode.142": "LocalLockTimeout",
  "ExitCode.143": "NoBash",
  "ExitCode.144": "InvalidHostName",
  "ExitCode.145": "BadInstallScriptResult",
  "ExitCode.146": "ShellRequestFailedOnChannel",
  "ExitCode.147": "InvalidPortRange",
  "ExitCode.148": "SendDisconnectBrokenPipe",
  "ExitCode.149": "LocalServerCrashed",
  "ExitCode.150": "NoFreePortInRange",
  "ExitCode.151": "InvalidCustomServerPath",
  "ExitCode.192": "AlreadyInProgress",
  "ExitCode.193": "ServerDownloadFailed",
  "ExitCode.194": "NoDownloaderAvailable",
  "ExitCode.195": "NoDownloaderAvailableForStatusCheck",
  "ExitCode.196": "UnsupportedArch",
  "ExitCode.197": "StatusCheckFailed",
  "ExitCode.198": "NeedInsidersArch",
  "ExitCode.199": "ServerTransferFailed",
  "ExitCode.200": "ServerFailedToStart",
  "ExitCode.201": "NeedInsidersWindows",
  "ExitCode.202": "CreateInstallDirFailed",
  "ExitCode.203": "UnsupportedPlatform",
  "ExitCode.204": "ServerTerminatedCVE20201416",
  "ExitCode.205": "UnpackFailed",
  "ExitCode.206": "ChangeDirFailed",
  "ExitCode.1023": "UnclassifiedError",
  "ExitCode.OK": "0",
  "ExitCode.LinuxPrereqs": "64",
  "ExitCode.ProxyAuthenticationRequired": "65",
  "ExitCode.UnparsableOutput": "128",
  "ExitCode.EmptyOutput": "129",
  "ExitCode.UnhandledResolverExitCode": "131",
  "ExitCode.OfflineError": "132",
  "ExitCode.SshInstall": "133",
  "ExitCode.FindLocalPort": "134",
  "ExitCode.Timeout": "135",
  "ExitCode.ExhaustedRetries": "136",
  "ExitCode.PermissionDenied": "137",
  "ExitCode.MitmPortForwardingDisabled": "138",
  "ExitCode.Canceled": "139",
  "ExitCode.BadLocalDownloadRequest": "140",
  "ExitCode.LocalDownloadFailed": "141",
  "ExitCode.LocalLockTimeout": "142",
  "ExitCode.NoBash": "143",
  "ExitCode.InvalidHostName": "144",
  "ExitCode.BadInstallScriptResult": "145",
  "ExitCode.ShellRequestFailedOnChannel": "146",
  "ExitCode.InvalidPortRange": "147",
  "ExitCode.SendDisconnectBrokenPipe": "148",
  "ExitCode.LocalServerCrashed": "149",
  "ExitCode.NoFreePortInRange": "150",
  "ExitCode.InvalidCustomServerPath": "151",
  "ExitCode.AlreadyInProgress": "192",
  "ExitCode.ServerDownloadFailed": "193",
  "ExitCode.NoDownloaderAvailable": "194",
  "ExitCode.NoDownloaderAvailableForStatusCheck": "195",
  "ExitCode.UnsupportedArch": "196",
  "ExitCode.StatusCheckFailed": "197",
  "ExitCode.NeedInsidersArch": "198",
  "ExitCode.ServerTransferFailed": "199",
  "ExitCode.ServerFailedToStart": "200",
  "ExitCode.NeedInsidersWindows": "201",
  "ExitCode.CreateInstallDirFailed": "202",
  "ExitCode.UnsupportedPlatform": "203",
  "ExitCode.ServerTerminatedCVE20201416": "204",
  "ExitCode.UnpackFailed": "205",
  "ExitCode.ChangeDirFailed": "206",
  "ExitCode.UnclassifiedError": "1023",
  "InstallUnpackCode.Success": "success",
  "InstallUnpackCode.Error": "error",
  "InstallUnpackCode.MissingFiles": "missingFiles",
  "uuid": "fb18acbd15fd",
  "startMarker": "fb18acbd15fd: running",
  "commitId": "fabdb6a30b49f79a7aba0f2ad9df9b399473380f",
  "quality": "stable",
  "token": "1111a1aa-a111-111a-11a1-1aaa1a111aa1",
  "vscodeAgentFolder": "$HOME/.vscode-server",
  "allowClientDownload": "1",
  "forceClientDownload": "0",
  "cliNameInArchive": "code",
  "ignoreWgetConfigFlag": " --no-config ",
  "ignoreCurlConfigFlag": " --disable ",
  "wgetTriesSegment": "--tries=1",
  "listenArgs": "--on-host=127.0.0.1 --on-port",
  "getDownloadServerStartTrigger": "fb18acbd15fd:trigger_server_download",
  "getDownloadServerEndTrigger": "fb18acbd15fd:trigger_server_download_end",
  "getProgressDownloading": "fb18acbd15fd%%1%%",
  "getProgressInstalling": "fb18acbd15fd%%2%%",
  "printVars": "echo \"SSH_AUTH_SOCK==$SSH_AUTH_SOCK==\"\necho \"DISPLAY==$DISPLAY==\""
}
[17:06:03.106] Install and start server if needed
[17:06:03.109] Checking ssh with "c:\Users\WangYanJie\AppData\Local\Programs\cursor\resources\app\bin\ssh.exe -V"
[17:06:03.111] Got error from ssh: spawn c:\Users\WangYanJie\AppData\Local\Programs\cursor\resources\app\bin\ssh.exe ENOENT
[17:06:03.111] Checking ssh with "C:\Program Files\Python36\Scripts\ssh.exe -V"
[17:06:03.112] Got error from ssh: spawn C:\Program Files\Python36\Scripts\ssh.exe ENOENT
[17:06:03.112] Checking ssh with "C:\Program Files\Python36\ssh.exe -V"
[17:06:03.112] Got error from ssh: spawn C:\Program Files\Python36\ssh.exe ENOENT
[17:06:03.113] Checking ssh with "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin\ssh.exe -V"
[17:06:03.113] Got error from ssh: spawn C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin\ssh.exe ENOENT
[17:06:03.113] Checking ssh with "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\libnvvp\ssh.exe -V"
[17:06:03.114] Got error from ssh: spawn C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\libnvvp\ssh.exe ENOENT
[17:06:03.114] Checking ssh with "C:\Program Files (x86)\Common Files\Oracle\Java\javapath\ssh.exe -V"
[17:06:03.114] Got error from ssh: spawn C:\Program Files (x86)\Common Files\Oracle\Java\javapath\ssh.exe ENOENT
[17:06:03.115] Checking ssh with "C:\WINDOWS\system32\ssh.exe -V"
[17:06:03.115] Got error from ssh: spawn C:\WINDOWS\system32\ssh.exe ENOENT
[17:06:03.115] Checking ssh with "C:\WINDOWS\ssh.exe -V"
[17:06:03.116] Got error from ssh: spawn C:\WINDOWS\ssh.exe ENOENT
[17:06:03.116] Checking ssh with "C:\WINDOWS\System32\Wbem\ssh.exe -V"
[17:06:03.117] Got error from ssh: spawn C:\WINDOWS\System32\Wbem\ssh.exe ENOENT
[17:06:03.117] Checking ssh with "C:\WINDOWS\System32\WindowsPowerShell\v1.0\ssh.exe -V"
[17:06:03.117] Got error from ssh: spawn C:\WINDOWS\System32\WindowsPowerShell\v1.0\ssh.exe ENOENT
[17:06:03.117] Checking ssh with "C:\WINDOWS\System32\OpenSSH\ssh.exe -V"
[17:06:03.156] > OpenSSH_for_Windows_9.5p1, LibreSSL 3.8.2

[17:06:03.159] Remote command length: 4968/8192 characters
[17:06:03.159] Running script with connection command: "C:\WINDOWS\System32\OpenSSH\ssh.exe" -T -D 63452 "金达" powershell
[17:06:03.160] Generated SSH command: 'type "C:\Users\WANGYA~1\AppData\Local\Temp\vscode-linux-multi-line-command----857715605.sh" | "C:\WINDOWS\System32\OpenSSH\ssh.exe" -T -D 63452 "金达" powershell'
[17:06:03.161] Using connect timeout of 17 seconds
[17:06:03.162] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[17:06:03.379] > 
[17:06:03.379] Got some output, clearing connection timeout
[17:06:04.068] > Administrator@47.117.121.221's password:
[17:06:04.069] Showing password prompt
[17:06:15.022] Got password response
[17:06:15.022] "install" wrote data to terminal: "********"
[17:06:15.052] > 
[17:06:16.101] > Windows PowerShell 
> ��Ȩ���� (C) Microsoft Corporation����������Ȩ����PS C:\Users\Administrator> 
> PS C:\Users\Administrator> 
[17:06:16.117] > $uuid="fb18acbd15f
[17:06:16.129] > d"
> PS C:\Users\Administrator> "${uuid}: running"
> fb18acbd15fd: running
[17:06:16.145] > PS C:\Users\Administrator> "fb18acbd15fd: pauseLog"
> fb18acbd15fd: pauseLog
[17:06:16.669] > fb18acbd15fd: resumeLog
[17:06:16.685] > 
> PS C:\Users\Administrator> m
[17:06:16.716] > ain
[17:06:17.086] > Looking for existing CLI in C:\Users\Administrator\.vscode-server
> Downloading cli x64
> fb18acbd15fd%%1%%
[17:06:17.109] > 
[17:06:18.712] > Expanding cli into C:\Users\Administrator\AppData\Local\Temp\ma0bswp1.nwf
[17:06:18.742] > 
> fb18acbd15fd%%2%%
[17:06:20.365] > Starting cli: & 'C:\Users\Administrator\.vscode-server\code-fabdb6a30b49f79a7aba
> a0f2ad9df9b399473380f.exe' command-shell --cli-data-dir 'C:\Users\Administrator\.
> .vscode-server\cli' --parent-process-id 11128 --on-host 127.0.0.1 --on-port --req
> quire-token 3786f2bd-f041-450e-83a9-0aaf1b946db7 *> 'C:\Users\Administrator\AppDa
> ata\Local\Temp\tmp62A8.tmp'
[17:06:24.432] > Server did not start successfully. Full server log at C:\Users\Administrator\App
> pData\Local\Temp\tmp62A8.tmp >>>
[17:06:24.445] > 
> <<< End of server log
> fb18acbd15fd: start
> exitCode==200==
> listeningOn====
> osReleaseId==windows==
> osVersion====
> arch==x64==
> platform==windows==
> unpackResult==success==
[17:06:24.464] > 
> didLocalDownload==False==
> downloadTime==1607==
> installTime==1627==
> extInstallTime====
> serverStartTime==75==
> execServerToken==1111a1aa-a111-111a-11a1-1aaa1a111aa1==
> fb18acbd15fd: end
[17:06:24.465] Received install output: 
exitCode==200==
listeningOn====
osReleaseId==windows==
osVersion====
arch==x64==
platform==windows==
unpackResult==success==
didLocalDownload==False==
downloadTime==1607==
installTime==1627==
extInstallTime====
serverStartTime==75==
execServerToken==1111a1aa-a111-111a-11a1-1aaa1a111aa1==

[17:06:24.467] Resolver error: Error: VS Code 服务器启动失败
	at v.ServerInstallError (c:\Users\WangYanJie\.vscode\extensions\ms-vscode-remote.remote-ssh-0.116.1\out\extension.js:2:696442)
	at f (c:\Users\WangYanJie\.vscode\extensions\ms-vscode-remote.remote-ssh-0.116.1\out\extension.js:2:690737)
	at t.handleInstallOutput (c:\Users\WangYanJie\.vscode\extensions\ms-vscode-remote.remote-ssh-0.116.1\out\extension.js:2:692563)
	at t.tryInstall (c:\Users\WangYanJie\.vscode\extensions\ms-vscode-remote.remote-ssh-0.116.1\out\extension.js:2:812473)
	at async c:\Users\WangYanJie\.vscode\extensions\ms-vscode-remote.remote-ssh-0.116.1\out\extension.js:2:771431
	at async t.withShowDetailsEvent (c:\Users\WangYanJie\.vscode\extensions\ms-vscode-remote.remote-ssh-0.116.1\out\extension.js:2:774668)
	at async x (c:\Users\WangYanJie\.vscode\extensions\ms-vscode-remote.remote-ssh-0.116.1\out\extension.js:2:768087)
	at async t.resolve (c:\Users\WangYanJie\.vscode\extensions\ms-vscode-remote.remote-ssh-0.116.1\out\extension.js:2:772083)
	at async c:\Users\WangYanJie\.vscode\extensions\ms-vscode-remote.remote-ssh-0.116.1\out\extension.js:2:1055245
[17:06:24.470] ------




[17:06:24.811] > 
[17:06:24.933] > fb18acbd15fd: start
> SSH_AUTH_SOCK====
> listeningOn====
> osReleaseId==windows==
> osVersion==10.0.17763==
> arch==x64==
> platform==windows==
> unpackResult==success==
> didLocalDownload==False==
> downloadTime==1607==
> installTime==1627==
> extInstallTime====
> serverStartTime==75==
> execServerToken==1111a1aa-a111-111a-11a1-1aaa1a111aa1==
> fb18acbd15fd: end
> 8032, watching 11128

@baiej214
Copy link
Author

Here's what the terminal outputs after running with '''trace': true' configured:

PS D:\project\test> npm run dev
runtime.launch Bootloader imported {
  env: {
    inspectorIpc: '\\\\.\\pipe\\node-cdp.12424-256e445b-1.sock',
    deferredMode: false,
    waitForDebugger: '',
    execPath: 'C:\\Users\\Administrator\\.vscode-server\\bin\\fabdb6a30b49f79a7aba0f2ad9df9b399473380f\\node.exe',
    onlyEntrypoint: false,
    verbose: true,
    autoAttachMode: 'always',
    mandatePortTracking: true,
    fileCallback: 'C:\\Users\\Administrator\\AppData\\Local\\Temp\\node-debug-callback-1f90dda3f8e27dd0'
  },
  args: [
    'C:\\Program Files\\nodejs\\node.exe',
    'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
    'run',
    'dev'
  ]
}
runtime Set debug mode { mode: 2 }

> test@1.0.0 dev
> node .\index.js

runtime.launch Bootloader imported {
  env: {
    inspectorIpc: '\\\\.\\pipe\\node-cdp.12424-256e445b-1.sock',
    deferredMode: false,
    waitForDebugger: '',
    execPath: 'C:\\Users\\Administrator\\.vscode-server\\bin\\fabdb6a30b49f79a7aba0f2ad9df9b399473380f\\node.exe',
    onlyEntrypoint: false,
    verbose: true,
    autoAttachMode: 'always',
    mandatePortTracking: true
  },
  args: [
    'C:\\Program Files\\nodejs\\node.exe',
    'D:\\project\\test\\index.js'
  ]
}
runtime Set debug mode { mode: 2 }
123

@roblourens

@baiej214
Copy link
Author

/jsDebugLogs

Please forgive me, I don't quite understand what this means? And how to do it.

Here's the log file package that was created: vscode-debugadapter-7b93ff6d.json.gz

@connor4312
Copy link
Member

connor4312 commented Dec 20, 2024

It looks like you're using Node 23. They had a regression that broke the debugger (nodejs/node#56002) please use Node <= 23.1.0 until they release the fix.


@baiej214 in the SSH logs it says something like:

[17:06:24.432] > Server did not start successfully. Full server log at C:\Users\Administrator\App
> pData\Local\Temp\tmp62A8.tmp

Could you also help us by sharing the contents of that log file? Thank you!

@baiej214
Copy link
Author

Hi @connor4312

According to the downgraded version you said, it was really solved!!Thank you!

Here's what you're referring to in its entirety:

Listening on 127.0.0.1:51094
Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

3 participants