I have a nvim setup that I have created and when I want to open a react/nextjs project it errors on imports like import Image from "next/image"; and no one likes that, so I wanted to ask how can I fix it.
the error reads:
eslint_d: failed to decode json: Expected value but found invalid token at charecter 1.
It is a new nextjs project, so it probably shouldn't be a configuration mistake.
here is the code:
return {
"nvimtools/none-ls.nvim",
dependencies = {
"nvimtools/none-ls-extras.nvim",
},
config = function()
local null_ls = require("null-ls")
null_ls.setup({
sources = {
null_ls.builtins.formatting.stylua,
null_ls.builtins.formatting.prettier,
require("none-ls.diagnostics.eslint_d"),
},
})
vim.keymap.set("n", "<leader>gf", vim.lsp.buf.format, {})
end,
}
and
return {
{
"williamboman/mason.nvim",
config = function()
require("mason").setup()
end,
},
{
"williamboman/mason-lspconfig.nvim",
config = function()
require("mason-lspconfig").setup({
ensure_installed = { "lua_ls", "ts_ls" },
automatic_installation = true,
})
end,
},
{
"neovim/nvim-lspconfig",
config = function()
local capabilities = require("cmp_nvim_lsp").default_capabilities()
local lspconfig_util = require("lspconfig.util") -- needed for root_pattern
-- Lua LSP (Neovim config)
vim.lsp.config("lua_ls", {
capabilities = capabilities,
settings = {
Lua = {
diagnostics = { globals = { "vim" } },
},
},
})
-- TypeScript / React / Next.js
vim.lsp.config("ts_ls", {
capabilities = capabilities,
filetypes = { "typescript", "typescriptreact", "javascript", "javascriptreact" },
root_dir = lspconfig_util.root_pattern("tsconfig.json", "package.json", "next.config.js", ".git"),
settings = {
typescript = {
preferences = {
importModuleSpecifierPreference = "non-relative",
},
},
},
})
-- Keymaps
vim.keymap.set("n", "K", vim.lsp.buf.hover, { desc = "LSP Hover" })
vim.keymap.set("n", "gd", vim.lsp.buf.definition, { desc = "Go to Definition" })
vim.keymap.set({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, { desc = "Code Action" })
end,
},
}
lspInfo:
==============================================================================
vim.lsp: ✅
- LSP log level : WARN
- Log path: C:/Users/1/AppData/Local/nvim-data/lsp.log
- Log size: 7 KB
vim.lsp: Active Clients ~
- null-ls (id: 1)
- Version: ? (no serverInfo.version response)
- Root directory: ~\Desktop\project\nextjs\school-project
- Command: <function @C:/Users/1/AppData/Local/nvim-data/lazy/none-ls.nvim/lua/null-ls/rpc.lua:61>
- Settings: {}
- Attached buffers: 11
vim.lsp: Enabled Configurations ~
- lua_ls:
- capabilities: {
textDocument = {
completion = {
completionItem = {
commitCharactersSupport = true,
deprecatedSupport = true,
insertReplaceSupport = true,
insertTextModeSupport = {
valueSet = { 1, 2 }
},
labelDetailsSupport = true,
preselectSupport = true,
resolveSupport = {
properties = { "documentation", "additionalTextEdits", "insertTextFormat", "insertTextMode", "command" }
},
snippetSupport = true,
tagSupport = {
valueSet = { 1 }
}
},
completionList = {
itemDefaults = { "commitCharacters", "editRange", "insertTextFormat", "insertTextMode", "data" }
},
contextSupport = true,
dynamicRegistration = false,
insertTextMode = 1
}
}
}
- cmd: { "lua-language-server" }
- filetypes: lua
- root_markers: { ".luarc.json", ".luarc.jsonc", ".luacheckrc", ".stylua.toml", "stylua.toml", "selene.toml", "selene.yml", ".git" }
- settings: {
Lua = {
diagnostics = {
globals = { "vim" }
}
}
}
- stylua:
- cmd: { "stylua", "--lsp" }
- filetypes: lua
- root_markers: { ".stylua.toml", "stylua.toml", ".editorconfig" }
- ts_ls:
- capabilities: {
textDocument = {
completion = {
completionItem = {
commitCharactersSupport = true,
deprecatedSupport = true,
insertReplaceSupport = true,
insertTextModeSupport = {
valueSet = { 1, 2 }
},
labelDetailsSupport = true,
preselectSupport = true,
resolveSupport = {
properties = { "documentation", "additionalTextEdits", "insertTextFormat", "insertTextMode", "command" }
},
snippetSupport = true,
tagSupport = {
valueSet = { 1 }
}
},
completionList = {
itemDefaults = { "commitCharacters", "editRange", "insertTextFormat", "insertTextMode", "data" }
},
contextSupport = true,
dynamicRegistration = false,
insertTextMode = 1
}
}
}
- cmd: { "typescript-language-server", "--stdio" }
- commands: {
["editor.action.showReferences"] = <function 1>
}
- filetypes: typescript, typescriptreact, javascript, javascriptreact
- handlers: {
["_typescript.rename"] = <function 1>
}
- init_options: {
hostInfo = "neovim"
}
- on_attach: <function @C:/Users/1/AppData/Local/nvim-data/lazy/nvim-lspconfig/lsp/ts_ls.lua:111>
- root_dir: <function @C:/Users/1/AppData/Local/nvim-data/lazy/nvim-lspconfig/lua/lspconfig/util.lua:32>
vim.lsp: File Watcher ~
- file watching "(workspace/didChangeWatchedFiles)" disabled on all clients
vim.lsp: Position Encodings ~
- No buffers contain mixed position encodings
lsp logs:
[WARN][2025-10-17 11:09:16] .../lua/vim/lsp.lua:432 "lua_ls does not have a configuration"
[WARN][2025-10-17 11:09:16] .../lua/vim/lsp.lua:432 "rust_analyzer does not have a configuration"
[WARN][2025-10-17 11:09:16] .../lua/vim/lsp.lua:432 "tailwindcss does not have a configuration"
[WARN][2025-10-17 11:09:47] .../lua/vim/lsp.lua:432 "gopls does not have a configuration"
[WARN][2025-10-17 11:09:47] .../lua/vim/lsp.lua:432 "lua_ls does not have a configuration"
[WARN][2025-10-17 11:09:47] .../lua/vim/lsp.lua:432 "rust_analyzer does not have a configuration"
[WARN][2025-10-17 11:09:47] .../lua/vim/lsp.lua:432 "tailwindcss does not have a configuration"
[WARN][2025-10-17 11:09:47] .../lua/vim/lsp.lua:432 "ts_ls does not have a configuration"
[WARN][2025-10-17 11:09:47] .../lua/vim/lsp.lua:432 "gopls does not have a configuration"
[WARN][2025-10-17 11:09:47] .../lua/vim/lsp.lua:432 "lua_ls does not have a configuration"
[WARN][2025-10-17 11:09:47] .../lua/vim/lsp.lua:432 "rust_analyzer does not have a configuration"
[WARN][2025-10-17 11:09:47] .../lua/vim/lsp.lua:432 "tailwindcss does not have a configuration"
[WARN][2025-10-17 11:09:47] .../lua/vim/lsp.lua:432 "ts_ls does not have a configuration"
[START][2025-10-17 12:36:41] LSP logging initiated
[WARN][2025-10-17 12:36:41] ...lsp/handlers.lua:564 'Failed to modify settings:\n* The current mode is single-file mode, server cannot create `.luarc.json` without workspace.\n* The language client dose not support modifying settings from the server side.\n\nPlease modify following settings manually:\n* `Lua.diagnostics.globals`: add element `"vim"` ;\n'
[START][2025-10-17 13:12:39] LSP logging initiated
[WARN][2025-10-17 13:12:39] .../lua/vim/lsp.lua:432 "lua_ts does not have a configuration"
[START][2025-10-17 13:15:32] LSP logging initiated
[WARN][2025-10-17 13:15:32] .../lua/vim/lsp.lua:432 "lua_ts does not have a configuration"
[START][2025-10-17 14:21:48] LSP logging initiated
[WARN][2025-10-17 14:21:48] ...lsp/handlers.lua:564 'Failed to modify settings:\n* The current mode is single-file mode, server cannot create `.luarc.json` without workspace.\n* The language client dose not support modifying settings from the server side.\n\nPlease modify following settings manually:\n* `Lua.diagnostics.globals`: add element `"vim"` ;\n'
[START][2025-10-17 14:25:01] LSP logging initiated
[WARN][2025-10-17 14:25:01] ...lsp/handlers.lua:564 'Failed to modify settings:\n* The current mode is single-file mode, server cannot create `.luarc.json` without workspace.\n* The language client dose not support modifying settings from the server side.\n\nPlease modify following settings manually:\n* `Lua.diagnostics.globals`: add element `"vim"` ;\n'
[START][2025-10-17 14:31:18] LSP logging initiated
[WARN][2025-10-17 14:31:18] ...lsp/handlers.lua:564 'Failed to modify settings:\n* The current mode is single-file mode, server cannot create `.luarc.json` without workspace.\n* The language client dose not support modifying settings from the server side.\n\nPlease modify following settings manually:\n* `Lua.diagnostics.globals`: add element `"vim"` ;\n'
[START][2025-10-19 17:25:58] LSP logging initiated
[WARN][2025-10-19 17:25:58] ...lsp/handlers.lua:564 'Failed to modify settings:\n* The current mode is single-file mode, server cannot create `.luarc.json` without workspace.\n* The language client dose not support modifying settings from the server side.\n\nPlease modify following settings manually:\n* `Lua.diagnostics.globals`: add element `"vim"` ;\n'
[START][2025-10-19 17:44:02] LSP logging initiated
[ERROR][2025-10-19 17:44:02] ...p/_transport.lua:36 "rpc" "stylua" "stderr" "\nthread 'main' panicked at src\\cli\\lsp.rs:27:63:\nbyte index 358 is not a char boundary; it is inside '█' (bytes 356..359) of `return {\n\t\"goolord/alpha-nvim\",\n\tdependencies = { \"echasnovski/mini.icons\" },\n\tconfig = function()\n\t\tlocal alpha = require(\"alpha\")\n\t\tlocal dashboard = require(\"alpha.themes.dashboard\")\n\n\t\t-- Set header\n\t\tdashboard.section.header.val = {\n\t\t\t\" `[...]\nnote: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n"
[START][2025-10-19 20:07:14] LSP logging initiated
[WARN][2025-10-19 20:07:14] ...lsp/handlers.lua:564 'Failed to modify settings:\n* The current mode is single-file mode, server cannot create `.luarc.json` without workspace.\n* The language client dose not support modifying settings from the server side.\n\nPlease modify following settings manually:\n* `Lua.diagnostics.globals`: add element `"vim"` ;\n'
[START][2025-10-20 18:55:00] LSP logging initiated
[WARN][2025-10-20 18:55:00] .../lua/vim/lsp.lua:52 "method textDocument/hover is not supported by any of the servers registered for the current buffer"
[START][2025-10-20 19:07:14] LSP logging initiated
[WARN][2025-10-20 19:07:14] .../lua/vim/lsp.lua:432 "null-ls does not have a configuration"
[WARN][2025-10-20 19:07:15] .../lua/vim/lsp.lua:432 "null-ls does not have a configuration"
[ERROR][2025-10-20 19:07:15] .../lua/vim/lsp.lua:496 "cannot start null-ls due to config error: C:/Program Files/Neovim/share/nvim/runtime/lua/vim/lsp.lua:485: attempt to index local 'config' (a nil value)"
[WARN][2025-10-20 19:07:15] .../lua/vim/lsp.lua:432 "null-ls does not have a configuration"
[WARN][2025-10-20 19:07:15] .../lua/vim/lsp.lua:432 "null-ls does not have a configuration"
[WARN][2025-10-20 19:07:22] .../lua/vim/lsp.lua:432 "null-ls does not have a configuration"
[WARN][2025-10-20 19:07:22] .../lua/vim/lsp.lua:432 "null-ls does not have a configuration"
[WARN][2025-10-20 19:07:22] .../lua/vim/lsp.lua:432 "null-ls does not have a configuration"
[WARN][2025-10-20 19:07:31] .../lua/vim/lsp.lua:432 "null-ls does not have a configuration"
[START][2025-10-20 19:08:54] LSP logging initiated
[WARN][2025-10-20 19:08:54] .../lua/vim/lsp.lua:432 "null-ls does not have a configuration"
[WARN][2025-10-20 19:08:55] .../lua/vim/lsp.lua:432 "null-ls does not have a configuration"
[ERROR][2025-10-20 19:08:55] .../lua/vim/lsp.lua:496 "cannot start null-ls due to config error: C:/Program Files/Neovim/share/nvim/runtime/lua/vim/lsp.lua:485: attempt to index local 'config' (a nil value)"
[WARN][2025-10-20 19:08:55] .../lua/vim/lsp.lua:432 "null-ls does not have a configuration"
[WARN][2025-10-20 19:08:55] .../lua/vim/lsp.lua:432 "null-ls does not have a configuration"
[WARN][2025-10-20 19:09:09] .../lua/vim/lsp.lua:432 "null-ls does not have a configuration"
[WARN][2025-10-20 19:09:10] .../lua/vim/lsp.lua:432 "null-ls does not have a configuration"
[WARN][2025-10-20 19:09:10] .../lua/vim/lsp.lua:432 "null-ls does not have a configuration"
[START][2025-10-20 19:59:02] LSP logging initiated
[WARN][2025-10-20 19:59:02] .../lua/vim/lsp.lua:52 "method textDocument/definition is not supported by any of the servers registered for the current buffer"
[START][2025-10-20 20:00:43] LSP logging initiated
[ERROR][2025-10-20 20:00:43] ...m/lsp/client.lua:620 "LSP[null-ls]" "Cannot find request with id 4 whilst attempting to cancel"
I have tried changing to the old ways and changing the none-ls configuration to the old way but it didn't work.