Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not find a valid tsserver version #411

Closed
ghostbuster91 opened this issue Feb 26, 2022 · 7 comments · Fixed by #412
Closed

Could not find a valid tsserver version #411

ghostbuster91 opened this issue Feb 26, 2022 · 7 comments · Fixed by #412

Comments

@ghostbuster91
Copy link

Hi,

I am trying to setup neovim with typescript language support through lsp. I use nix.
I already saw #336 and #28

I tried multiple things but whatever I do I always get the same error message:

RPC[Error] code_name = InternalError, message = "Request initialize failed with message: Could not find a valid tsserver version. Exiting."

I even provided explicitly path to the tsserver:

    require("lspconfig")["tsserver"].setup({
                on_attach = on_attach,
                capabilities = capabilities,
                cmd = { 
          "/nix/store/mis3pr62zjli08kdxg6lqhvkjbiih7kq-typescript-language-server-0.9.6/bin/typescript-language-server",
          "--stdio",
          "--tsserver-path",
          "/nix/store/cq9s34idhmcwqiy4jb89ghlpr6x6wiz1-typescript-4.5.5/lib/" }
    })

Calling typescript-language-server explicitly with above parameters doesn't yield any errors.

/nix/store/mis3pr62zjli08kdxg6lqhvkjbiih7kq-typescript-language-server-0.9.6/bin/typescript-language-server \
--stdio \
--tsserver-path /nix/store/cq9s34idhmcwqiy4jb89ghlpr6x6wiz1-typescript-4.5.5/lib/ \
--log-level 4 \
--tsserver-log-file=ts-logs.txt --tsserver-log-verbosity=verbose

I wish the error message was a little bit more descriptive.

Did it find tsserver at all? If so, why was it considered as invalid?

Could someone point me to a direction how can I debug that further?

Thanks in advance!

@rchl
Copy link
Member

rchl commented Feb 27, 2022

Running from the terminal doesn't reproduce because the discovery of typescript is only triggered after the LSP initialize message was received which doesn't happen when running manually like that.

I guess there could be some extra verbose log messages added to debug cases like that.

@rchl
Copy link
Member

rchl commented Feb 27, 2022

I've added additional logs that will be visible with --log-level 3 or higher that should make it is easy to debug this issue.

https://github.com/typescript-language-server/typescript-language-server/releases/tag/v0.9.7

@ghostbuster91
Copy link
Author

Thanks that was really fast, I will try with the newest version and let you know what I find.

@carbonizer
Copy link

@ghostbuster91 I ran into the same problem. You should have been targeting lib a few more levels down:

/nix/store/cq9s34idhmcwqiy4jb89ghlpr6x6wiz1-typescript-4.5.5/lib/node_modules/typescript/lib/

@ghostbuster91
Copy link
Author

@carbonizer Thanks a lot! It worked like a charm :)

@jrgiacone
Copy link

@carbonizer Thanks a lot! It worked like a charm :)

I get permission denied on this? any idea: Spawning language server with cmd: /nix/store/v4lcvq8ymzgyzc5iinpp 3lc5lvvgrl36-typescript-language-server-2.1.0/lib/node_modules/type script-language-server/lib/ failed with error message: EACCES: per
mission denied

@rchl
Copy link
Member

rchl commented Nov 29, 2022

Check the path. It looks kinda broken to me (there is a space in one place and also not sure about the directory structure):

/nix/store/v4lcvq8ymzgyzc5iinpp 3lc5lvvgrl36-typescript-language-server-2.1.0/lib/node_modules/type script-language-server/lib/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants