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

Can't find typescript.js or tsserverlibrary #351

Open
2 tasks
boh001 opened this issue Jan 22, 2024 · 2 comments
Open
2 tasks

Can't find typescript.js or tsserverlibrary #351

boh001 opened this issue Jan 22, 2024 · 2 comments

Comments

@boh001
Copy link

boh001 commented Jan 22, 2024

Problem description

lm developing in pnpm workspace. As far as I know, libraries like TypeScript that are commonly used when using Monorepo are in the root package.json. Similarly, in my case, Typescript is in the root package.json. so i deleted typescript in astro project's package.json. after that when i opened .astro file, i got the following error.

Error executing vim.schedule lua callback: ...w/Cellar/neovim/0.9.4/share/nvim/runtime/lua/vim/lsp.lua:1308: RPC[Error] code_name = InternalError, message = "Request initialize failed with message: Can't find typescript.js or tsserverlibrary.js in /Users/sanghyeon/projects/plzsub/apps/zpzp/web/node_modules/typescript/lib"
stack traceback:
	[C]: in function 'assert'
	...w/Cellar/neovim/0.9.4/share/nvim/runtime/lua/vim/lsp.lua:1308: in function ''
	vim/_editor.lua: in function <vim/_editor.lua:0>

Why do you think this is an issue with mason-lspconfig.nvim?

when typescript are in astro project's package.json, it works fine

Neovim version (>= 0.7)

NVIM v0.9.4
Build type: Release
LuaJIT 2.1.1700008891

Operating system/version

Darwin macstudio.local 22.6.0 Darwin Kernel Version 22.6.0: Tue Nov 7 21:42:24 PST 2023; root:xnu-8796.141.3.702.9~2/RELEASE_ARM64_T6020 arm64

I've manually reviewed the Nvim LPS client log (:LspLog) to find potential errors

  • Yes

I've recently downloaded the latest plugin version of mason.nvim, mason-lspconfig.nvim, and nvim-lspconfig

  • Yes

Affected language servers

astro

Steps to reproduce

  1. create astro project dir using pnpm create astro command in pnpm workspace
  2. open any .astro file(it works)
  3. delete typescript in astro project's package.json
  4. open any .astro file(get the error)

Actual behavior

get the error when open .astro file

Expected behavior

lsp works fine when open .astro file

LspInfo

0 client(s) attached to this buffer: 
 
 3 active client(s) not attached to this buffer: 
 
 Client: copilot (id: 1, bufnr: [])
 	filetypes:       
 	autostart:       false
 	root directory:  Running in single file mode.
 	cmd:             node /Users/sanghyeon/.local/share/nvim/lazy/copilot.vim/dist/agent.js --stdio
 
 Client: eslint (id: 2, bufnr: [19])
 	filetypes:       javascript, javascriptreact, javascript.jsx, typescript, typescriptreact, typescript.tsx, vue, svelte, astro
 	autostart:       true
 	root directory:  Running in single file mode.
 	cmd:             vscode-eslint-language-server --stdio
 
 Client: tailwindcss (id: 3, bufnr: [19])
 	filetypes:       aspnetcorerazor, astro, astro-markdown, blade, clojure, django-html, htmldjango, edge, eelixir, elixir, ejs, erb, eruby, gohtml, gohtmltmpl, haml, handlebars, hbs, html, html-eex, heex, jade, leaf, liquid, markdown, mdx, mustache, njk, nunjucks, php, razor, slim, twig, css, less, postcss, sass, scss, stylus, sugarss, javascript, javascriptreact, reason, rescript, typescript, typescriptreact, vue, svelte
 	autostart:       true
 	root directory:  Running in single file mode.
 	cmd:             tailwindcss-language-server --stdio
 
 Configured servers list: cssls, eslint, tsserver, marksman, terraformls, dockerls, bashls, docker_compose_language_service, jsonls, tailwindcss, html, astro, prismals, lua_ls

LspLog

No response

Healthcheck

mason: require("mason.health").check()

mason.nvim ~
- OK mason.nvim version v1.9.0
- OK PATH: prepend
- OK Providers: 
  mason.providers.registry-api
  mason.providers.client
- OK neovim version >= 0.7.0

mason.nvim [Registries] ~
- OK Registry `github.com/mason-org/mason-registry version: 2024-01-21-mute-men` is installed.

mason.nvim [Core utils] ~
- OK unzip: `UnZip 6.00 of 20 April 2009, by Info-ZIP.  Maintained by C. Spieler.  Send`
- WARNING wget: not available
  - ADVICE:
    - spawn: wget failed with exit code - and signal -. wget is not executable
- OK curl: `curl 8.1.2 (x86_64-apple-darwin22.0) libcurl/8.1.2 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.11 nghttp2/1.51.0`
- OK gzip: `Apple gzip 403.100.6`
- OK tar: `bsdtar 3.5.3 - libarchive 3.5.3 zlib/1.2.11 liblzma/5.0.5 bz2lib/1.0.8 `
- OK bash: `GNU bash, version 3.2.57(1)-release (arm64-apple-darwin22)`
- OK sh: `Ok`

mason.nvim [Languages] ~
- WARNING luarocks: not available
  - ADVICE:
    - spawn: luarocks failed with exit code - and signal -. luarocks is not executable
- WARNING Composer: not available
  - ADVICE:
    - spawn: composer failed with exit code - and signal -. composer is not executable
- WARNING PHP: not available
  - ADVICE:
    - spawn: php failed with exit code - and signal -. php is not executable
- OK Go: `go version go1.21.6 darwin/arm64`
- OK node: `v20.10.0`
- OK Ruby: `ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin22]`
- OK npm: `10.2.3`
- WARNING julia: not available
  - ADVICE:
    - spawn: julia failed with exit code - and signal -. julia is not executable
- OK python: `Python 3.11.7`
- OK java: `openjdk version "17.0.9" 2023-10-17 LTS`
- OK javac: `javac 17.0.9`
- OK cargo: `cargo 1.75.0 (1d8b05cdd 2023-11-20)`
- OK pip: `pip 23.3.1 from /opt/homebrew/lib/python3.11/site-packages/pip (python 3.11)`
- OK python venv: `Ok`
- OK RubyGem: `3.5.3`

mason.nvim [GitHub] ~
- OK GitHub API rate limit. Used: 2. Remaining: 58. Limit: 60. Reset: 월  1/22 10:08:09 2024.
  Install and authenticate via gh-cli to increase rate limit.

Screenshots or recordings

No response

@eliphazbouye
Copy link

I have same issue

mason: require("mason.health").check()

mason.nvim ~
- OK mason.nvim version v1.10.0
- OK PATH: prepend
- OK Providers: 
  mason.providers.registry-api
  mason.providers.client
- OK neovim version >= 0.7.0

mason.nvim [Registries] ~
- OK Registry `github.com/mason-org/mason-registry version: 2024-01-26-double-boat` is installed.

mason.nvim [Core utils] ~
- OK unzip: `UnZip 6.00 of 20 April 2009, by Info-ZIP.  Maintained by C. Spieler.  Send`
- OK wget: `GNU Wget 1.21.4 built on linux-gnu.`
- OK curl: `curl 8.6.0 (x86_64-pc-linux-gnu) libcurl/8.6.0 OpenSSL/3.2.1 zlib/1.3.1 brotli/1.1.0 zstd/1.5.5 libidn2/2.3.7 libpsl/0.21.2 libssh2/1.11.0 nghttp2/1.59.0 nghttp3/1.1.0`
- OK gzip: `gzip 1.13`
- OK tar: `tar (GNU tar) 1.35`
- OK bash: `GNU bash, version 5.2.26(1)-release (x86_64-pc-linux-gnu)`
- OK sh: `Ok`

@metallerok
Copy link

I manually set path to tssserver.js and it works

lspconfig.volar.setup({
    capabilities = capabilities,
    filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' },
    init_options = {
        vue = {
            hybridMode = false,
        },
        typescript = {
            tsdk = "/home/administrator/.local/share/nvim/mason/packages/vue-language-server/node_modules/typescript/lib/"
        },
    },
})

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

No branches or pull requests

3 participants