No log generated
### Debug adapter definition and debug configuration
I'm trying to setup nvim to debug lua files. I've followed several tutorials but nothing seems to work. I've also tried to attach vs launch.
```lua
local dap = require("dap")
-- LUA DAP
dap.configurations.lua = {
{
name = "Attach to running Neovim instance",
type = 'nlua',
request = 'attach',
host = "127.0.0.1", -- Where the server is running
port = 8086, -- Standard port for LoadDebug/Tom Blind's adapter: 8086. For LoadDebug: 8818
}
}
table.insert(dap.configurations.lua, {
name = "Launch Lua Script (LLDebug)",
type = "local-lua",
request = "launch",
cwd = "${workspaceFolder}",
program = {
lua = 'lua5.4', -- Tried command = 'lua5.4'
file = "${file}",
},
args = {},
})
table.insert(dap.configurations.lua, {
name = "Attach Lua Script (LLDebug)",
type = "local-lua",
request = "attach",
host = "127.0.0.1", -- Where the server is running
port = 8086, -- Standard port for LoadDebug/Tom Blind's adapter: 8086. For LoadDebug: 8818
cwd = "${workspaceFolder}",
program = "${file}",
})
-- Only define local-lua adapter if the path exists/is valid
local local_lua_ext_path = ...
dap.adapters["local-lua"] = {
type = "executable",
command = "node",
--command = "local-lua-dbg",
args = { local_lua_ext_path .. _jp("extension", "debugAdapter.js") },
enrich_config = function(config, on_config)
if not config["extensionPath"] then
local c = vim.deepcopy(config)
-- 💀 If this is missing or wrong you'll see
-- "module 'lldebugger' not found" errors in the dap-repl when trying to launch a debug session
c.extensionPath = local_lua_ext_path
on_config(c)
else
on_config(config)
end
end,
}
```
the paths are correct. I have no local-lua-dbg with both vscode extension and repo clone. I have no problem debugging with the vscode extension in vscode.
test script
```lua
require("lldebugger").start()
socket.sleep(10)
-- Example code to debug
local x = 10
print("Starting script...")
for i = 1, 5 do
local y = x + i -- <-- Set a breakpoint here in Neovim later
print("Iteration: " .. i .. ", y = " .. y)
-- Adding a small delay to give time to connect
socket.sleep(2)
end
print("Script finished.")
```
``notify.warn DAP command `node` of adapter `local-lua` exited with 1. Run :DapShowLog to open logs``
DapShowLog does nothing and there seems to be no log generated. Well, it actually takes me to the Dashboard.
Attach also does not work.
I followed: https://codeberg.org/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation#local-lua-debugger-vscode, https://zignar.net/2023/06/10/debugging-lua-in-neovim/, and a few others. All basically say the same thing. I've tried several variants of configurations but all produce the same result.
Because I'm not getting a log I have no idea what to do next.
--------------------
It seems that it can't find a file for some reason. I installed dapui and I get
'"undefined"' is not recognized as an internal or external command,
operable program or batch file.
I changed the arg from using debugAdapter.js to rundebugadapter.js and no error appeared but nothing happened. I tried hard coding the file path and using the variations of string or table for program and nothing.
It seems that some key value is not set and so it uses undefined to run. But I don't know where this is occurring in the chain.
### Debug adapter version
0.10
### Steps to Reproduce
I have no idea.
### Expected Result
To be able to debug lua scripts in neovim
### Actual Result
can't.
关闭于 2026-01-19 5 条评论