LspInfo: No active clients (pnpm, nx, packageManager)
I created a new nvim setup and I cannot get typescript-tools to attach to my file as LSP. There is typescript installed locally (also tried globally). I am opening normal .ts files. The ts_ls is removed from Mason (this is correct, right? It should directly connect to the typescript of the project, if I understand correctly).
My current lsp config:
return {
{
"williamboman/mason.nvim",
lazy = false,
opts = {}
},
{
"williamboman/mason-lspconfig.nvim",
lazy = false,
dependencies = {
"williamboman/mason.nvim",
"neovim/nvim-lspconfig",
},
opts = {
ensure_installed = {
"lua_ls"
}
},
},
{
"neovim/nvim-lspconfig",
lazy = false,
config = function()
local lspconfig = require("lspconfig")
lspconfig.lua_ls.setup({
settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using
-- (most likely LuaJIT in the case of Neovim)
version = 'LuaJIT',
},
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = {
'vim',
'require'
},
},
workspace = {
-- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file("", true),
},
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = {
enable = false,
},
},
}
})
end,
},
{
"pmizio/typescript-tools.nvim",
dependencies = { "nvim-lua/plenary.nvim", "neovim/nvim-lspconfig" },
}
}
And here is the :LspInfo, in which I would expect typescript-tools to be attached, right?
==============================================================================
vim.lsp: ✅
- LSP log level : WARN
- Log path: /Users/username/.local/state/nvim/lsp.log
- Log size: 122 KB
vim.lsp: Active Clients ~
- No active clients
vim.lsp: Enabled Configurations ~
- lua_ls:
- cmd: { "lua-language-server" }
- filetypes: lua
- root_markers: .luarc.json, .luarc.jsonc, .luacheckrc, .stylua.toml, stylua.toml, selene.toml, selene.yml, .git
vim.lsp: File Watcher ~
- file watching "(workspace/didChangeWatchedFiles)" disabled on all clients
vim.lsp: Position Encodings ~
- No active clients
Thank you very much for every hint. Right now I am out of ideas.
Hmm interesting, it seems to be project related. In another project it works. In the current pnpm nx mono repo it does not.
Okay, when running LspStart typescript-tools I get this error:
2 [ERROR][2025-07-22 21:38:28] .../lua/vim/lsp.lua:496 "cannot start typescript-tools due to config error: .../Cellar/neovim/0.11.3/share/nvim/runtime/lua/vim/lsp.lua:485: attempt to index local 'config' (a nil value)"
1 [WARN][2025-07-22 21:38:28] .../lua/vim/lsp.lua:432 "typescript-tools does not have a configuration"
Starting to think the issue is related to:
https://github.com/pmizio/typescript-tools.nvim/issues/151#issuecomment-2664526140
My npm root -g prints
This project is configured to use pnpm because /my-path/package.json has a "packageManager" field
Yes, it attaches, if I remove the packageManager field in the package.json. So the problem is here:
-- lua/typescript-tools/tsserver_provider.lua
---@private
---@return string, string[]
function TsserverProvider:make_npm_root_params() -- luacheck: ignore
local args = { "root", "-g" }
if is_win then
return "cmd.exe", { "/c", "npm", unpack(args) }
end
return "npm", args
end
Suggestion: https://github.com/pmizio/typescript-tools.nvim/pull/363
I am having similar-ish behavior, except it attaches the first time but if I try to do :LspRestart I receive the same error typescript-tools does not have a configuration.
My project also uses pnpm and specifies the packageManager field.
Same is happening to me with pnpm and packageManager fields.