Setup for NextJS Typescript project in WSL2 setup #1408
Unanswered
sarbajit125
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi guys, I am struggling to setup DAP and configuration for my Nextjs. No matter what I do it always throws error debugger slow to respond or incorrect cofiguration setup. I am using NvChad and here are my configurations.
`{
"mfussenegger/nvim-dap",
dependencies = {
-- Install the vscode-js-debug adapter
{
"microsoft/vscode-js-debug",
-- After install, build it and rename the dist directory to out
build = "npm install --legacy-peer-deps --no-save && npx gulp vsDebugServerBundle && rm -rf out && mv dist out",
version = "1.*",
},
{
"mxsdev/nvim-dap-vscode-js",
config = function()
---@diagnostic disable-next-line: missing-fields
require("dap-vscode-js").setup({
-- Path of node executable. Defaults to $NODE_PATH, and then "node"
-- node_path = "node",
}`
Here is my configs.dap file:
`local js_based_languages = {
"typescript",
"javascript",
"typescriptreact",
"javascriptreact",
"vue",
}
local dap = require('dap')
local mason_registry = require("mason-registry")
for _, language in ipairs(js_based_languages) do
dap.configurations[language] = {
-- Debug single nodejs files
{
type = "pwa-node",
request = "launch",
name = "Launch file",
program = "${file}",
cwd = vim.fn.getcwd(),
sourceMaps = true,
},
-- Debug nodejs processes (make sure to add --inspect when you run the process)
{
type = "pwa-node",
request = "attach",
name = "Attach",
processId = require("dap.utils").pick_process,
cwd = vim.fn.getcwd(),
sourceMaps = true,
},
-- Debug web applications (client side)
{
type = "pwa-chrome",
request = "launch",
name = "Launch & Debug Chrome",
url = function()
local co = coroutine.running()
return coroutine.create(function()
vim.ui.input({
prompt = "Enter URL: ",
default = "http://localhost:3000",
}, function(url)
if url == nil or url == "" then
return
else
coroutine.resume(co, url)
end
end)
end)
end,
webRoot = vim.fn.getcwd(),
protocol = "inspector",
sourceMaps = true,
userDataDir = false,
},
-- Divider for the launch.json derived configs
{
name = "----- ↓ launch.json configs ↓ -----",
type = "",
request = "launch",
},
}
end`
Here is my dap.log
` INFO ] 2024-12-26T19:10:30Z+0000 ] /root/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:814 ] "Telemetry" "js-debug/cdp/operation"
[ INFO ] 2024-12-26T19:22:18Z+0000 ] /root/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:814 ] "Telemetry" "js-debug/launch"
[ INFO ] 2024-12-26T19:24:21Z+0000 ] /root/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:814 ] "Telemetry" "js-debug/dap/operation"
[ INFO ] 2024-12-26T19:24:21Z+0000 ] /root/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:814 ] "Telemetry" "js-debug/dap/operation"
[ INFO ] 2024-12-26T19:26:12Z+0000 ] /root/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:1910 ] "Session closed due to disconnect"
[ INFO ] 2024-12-26T19:26:38Z+0000 ] /root/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:814 ] "Telemetry" "js-debug/launch"
[ INFO ] 2024-12-28T11:06:51Z+0000 ] /root/.local/share/nvim/lazy/nvim-dap/lua/dap/session.lua:814 ] "Telemetry" "js-debug/launch"`
Any help would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions