merrickluo / lsp-tailwindcss

the lsp-mode client for tailwindcss
GNU General Public License v3.0
180 stars 21 forks source link

Error after installing via language server - EBADF: bad file descriptor #54

Closed x-ji closed 1 year ago

x-ji commented 1 year ago

For some reason the tailwind language server errors and exits after I installed it via M-x lsp-install-server and tried to start it up. Here is the trace from tailwindcss::stderr:

(The plugin in my VSCode works fine in the meanwhile.)

node:events:505
      throw er; // Unhandled 'error' event
      ^

Error: EBADF: bad file descriptor, lstat '/dev/fd/108'
Emitted 'error' event on oT instance at:
    at oT._handleError (/Users/jx/.emacs.d/.cache/lsp/tailwindcss/extension/dist/tailwindServer.js:704:31706)
    at Y_.THe._boundHandleError (/Users/jx/.emacs.d/.cache/lsp/tailwindcss/extension/dist/tailwindServer.js:704:12331)
    at Y_.emit (node:events:527:28)
    at emitErrorNT (node:internal/streams/destroy:157:8)
    at emitErrorCloseNT (node:internal/streams/destroy:122:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -9,
  code: 'EBADF',
  syscall: 'lstat',
  path: '/dev/fd/108'
}

Process tailwindcss stderr finished

I suspect it might be a permission issue? Or maybe it's a mismatch between node versions in different places (I use asdf to manage my node version). Though I have no idea.

I'm using Spacemacs though I'm not sure if that's relevant to this error, since the installation is directly via lsp-install-server.

x-ji commented 1 year ago

The logs during the installation:

LSP :: Download tailwindcss started.
LSP :: Starting to download https://github.com/tailwindlabs/tailwindcss-intellisense/releases/download/v0.9.1/vscode-tailwindcss-0.9.1.vsix to /Users/jx/.emacs.d/.cache/lsp/tailwindcss/server.zip...
Contacting host: github.com:443
Wrote /Users/jx/.emacs.d/.cache/lsp/tailwindcss/server.zip
LSP :: Finished downloading /Users/jx/.emacs.d/.cache/lsp/tailwindcss/server.zip...
LSP :: Decompressing /Users/jx/.emacs.d/.cache/lsp/tailwindcss/server.zip...
(Shell command succeeded with no output)
LSP :: Decompressed /Users/jx/.emacs.d/.cache/lsp/tailwindcss/server...
LSP :: Server tailwindcss downloaded, auto-starting in 0 buffers.
x-ji commented 1 year ago

When I run lsp-uninstall-server, I see npm also being an option available. Not sure if that is related to the tailwind server in any way though.

merrickluo commented 1 year ago

yeah, this error log did look like an environment issue... which node is in your path? you can try M-x execute-extended-command and run (executable-find "node") in the buffer you are trying to use the language server to see which node got used.

x-ji commented 1 year ago

Weird. Now that I uninstalled the server and installed it again with lsp-install-server, it worked this time. (executable-find "node") returned "~/.asdf/shims/node" which seems to make sense.

merrickluo commented 1 year ago

glad it worked out :tada: