mxsdev / nvim-dap-vscode-js

nvim-dap adapter for vscode-js-debug
266 stars 24 forks source link

Starting/Running debuger throw SyntaxError: Unexpected token '??=' #52

Closed nghiango1 closed 4 months ago

nghiango1 commented 1 year ago

Error throw on start debuging sesson and exit. It seems that it happens because of node libary isn't compatible with the build file vsDebugServer.js. Is there have a specific requirement or I did it wrong?

[dap-js] JS Debugger stderr: /home/termux/.local/share/nvim/site/pack/packer/opt/vscode-js-debug/out/src/vsDebugServer.js:58
See: https://github.com/isaacs/node-glob/issues/167`);if(!... ar Tpe=require("path"),T8,$pe=()=>{if(process.platform==="win32")return T8??=D8(),T8},Mpe=t=>{var e;return(e=$pe())==null?void 0:e.getAppContainerProcessTokens().map(r=>(0,Tpe.joi
n)(r,t))};Lv.getAppContainerProcessTokens=Mpe});var Q8=b((QMe,Uv)=>{var jpe=require("fs"),Y8=require("path"),qpe=require("os"),Wpe=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\
s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function Vpe(t){let e={},r=t.toString();r=r.replace(/\r\n?/mg,`

SyntaxError: Unexpected token '??='
    at wrapSafe (internal/modules/cjs/loader.js:1029:16)
    at Module._compile (internal/modules/cjs/loader.js:1078:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
    at Module.load (internal/modules/cjs/loader.js:979:32)
    at Function.Module._load (internal/modules/cjs/loader.js:819:12)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12)
    at internal/main/run_main_module.js:17:47
Press ENTER or type command to continue
[dap-js] JS Debugger exited with code 1!

Here is my config file

require("dap-vscode-js").setup{
    node_path = "node", -- Path of node executable. vscode-js-debug require node verson 16
    adapters = { 'pwa-node', 'pwa-chrome', 'pwa-msedge', 'node-terminal', 'pwa-extensionHost' },
}

local dap = require('dap')
local js_languages = { "typescript", "javascript", "typescriptreact" }
for _, language in ipairs(js_languages) do
    dap.configurations[language] = {
        {
            type = "pwa-node",
            request = "launch",
            name = "Launch file",
            program = "${file}",
            cwd = "${workspaceFolder}",
        },
        {
            type = "pwa-node",
            request = "launch",
            name = "Launch Test Program (pwa-node with vitest)",
            cwd = "${workspaceFolder}",
            program = "${workspaceFolder}/node_modules/vitest/vitest.mjs",
            args = { "--threads", "false", },
            autoAttachChildProcesses = false,
            trace = true,
            console = "integratedTerminal",
            sourceMaps = true,
            smartStep = true,
        },
    }
end
WanderHuang commented 11 months ago

Error throw on start debuging sesson and exit. It seems that it happens because of node libary isn't compatible with the build file vsDebugServer.js. Is there have a specific requirement or I did it wrong?

[dap-js] JS Debugger stderr: /home/termux/.local/share/nvim/site/pack/packer/opt/vscode-js-debug/out/src/vsDebugServer.js:58
See: https://github.com/isaacs/node-glob/issues/167`);if(!... ar Tpe=require("path"),T8,$pe=()=>{if(process.platform==="win32")return T8??=D8(),T8},Mpe=t=>{var e;return(e=$pe())==null?void 0:e.getAppContainerProcessTokens().map(r=>(0,Tpe.joi
n)(r,t))};Lv.getAppContainerProcessTokens=Mpe});var Q8=b((QMe,Uv)=>{var jpe=require("fs"),Y8=require("path"),qpe=require("os"),Wpe=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\
s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function Vpe(t){let e={},r=t.toString();r=r.replace(/\r\n?/mg,`

SyntaxError: Unexpected token '??='
    at wrapSafe (internal/modules/cjs/loader.js:1029:16)
    at Module._compile (internal/modules/cjs/loader.js:1078:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
    at Module.load (internal/modules/cjs/loader.js:979:32)
    at Function.Module._load (internal/modules/cjs/loader.js:819:12)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12)
    at internal/main/run_main_module.js:17:47
Press ENTER or type command to continue
[dap-js] JS Debugger exited with code 1!

Here is my config file

require("dap-vscode-js").setup{
    node_path = "node", -- Path of node executable. vscode-js-debug require node verson 16
    adapters = { 'pwa-node', 'pwa-chrome', 'pwa-msedge', 'node-terminal', 'pwa-extensionHost' },
}

local dap = require('dap')
local js_languages = { "typescript", "javascript", "typescriptreact" }
for _, language in ipairs(js_languages) do
    dap.configurations[language] = {
        {
            type = "pwa-node",
            request = "launch",
            name = "Launch file",
            program = "${file}",
            cwd = "${workspaceFolder}",
        },
        {
            type = "pwa-node",
            request = "launch",
            name = "Launch Test Program (pwa-node with vitest)",
            cwd = "${workspaceFolder}",
            program = "${workspaceFolder}/node_modules/vitest/vitest.mjs",
            args = { "--threads", "false", },
            autoAttachChildProcesses = false,
            trace = true,
            console = "integratedTerminal",
            sourceMaps = true,
            smartStep = true,
        },
    }
end

This is a node syntax error, maybe you can update your node to latest version.