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

Volar tries to look for tsserver library in project directory instead of Mason's installation directory for Volar #43

Closed
2 tasks done
whollingsworth opened this issue Sep 2, 2022 · 3 comments

Comments

@whollingsworth
Copy link

Problem description

I'm running into the following error when opening a Vue file. It looks like Neovim is looking for tsserverlibrary.js in my project's node_modules folder instead of Mason's installation directory for the language server, which does have it.

Error executing vim.schedule lua callback: ...neovim/HEAD-12fe197_1/share/nvim/runtime/lua/vim/lsp.lua:1284: RPC[Error] code_name = InternalError, message = "
Request initialize failed with message: Cannot find module '/Users/whollingsworth/<project-directory>/node_modules/typescript/lib/tsserverlibrary.js'
\
Require stack:\
- /Users/whollingsworth/.local/share/nvim/mason/packages/vue-language-server/node_modules/@volar/vue-language-server/out/node.js\
- /Users/whollingsworth/.local/share/nvim/mason/packages/vue-language-server/node_modules/@volar/vue-language-server/bin/vue-language-server.js"
stack traceback:
        [C]: in function 'assert'
        ...neovim/HEAD-12fe197_1/share/nvim/runtime/lua/vim/lsp.lua:1284: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>

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

williamboman/mason.nvim#108 mentioned a similar issue was fixed in this project.

Neovim version (>= 0.7)

$ nvim --version
NVIM v0.8.0-dev-2465-g12fe197cf
Build type: Release
LuaJIT 2.1.0-beta3

Operating system/version

macOS Darwin Kernel Version 21.6.0 / Monterey 12.5.1

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

Volar

Steps to reproduce

  1. Create a new Vue project (vue create hello)
  2. Open src/App.vue

Actual behavior

The server does not start because Neovim looks for a required library in the projects node_modules directory instead of the server's

Expected behavior

The server starts

LspInfo

Language client log: /Users/whollingsworth/.local/state/nvim/lsp.log
 Detected filetype:   vue
 
 1 client(s) attached to this buffer: 
 
 Client: null-ls (id: 2, pid: 5001, bufnr: [1])
 	filetypes:       markdown, eruby, ruby, lua, rust
 	autostart:       false
 	root directory:  /Users/whollingsworth/<project-directory>
 	cmd:             nvim
 
 Other clients that match the filetype: vue
 
 Config: volar
 	filetypes:         vue
 	root directory:    /Users/whollingsworth/<project-directory>
 	cmd:               vue-language-server --stdio
 	cmd is executable: true
 	autostart:         true
 	custom handlers:   
 
 Configured servers list: tsserver, solargraph, sumneko_lua, volar


### LspLog

```Text
Nothing for volar/vue-language-server

Healthcheck

mason: require("mason.health").check()
========================================================================
## mason.nvim report
  - OK: neovim version >= 0.7.0
  - WARNING: **Go**: not available
  - OK: **cargo**: `cargo 1.63.0 (fd9c4297c 2022-07-01)`
  - OK: **luarocks**: `/usr/local/bin/luarocks 3.9.1`
  - OK: **Ruby**: `ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a) [x86_64-darwin21]`
  - OK: **RubyGem**: `3.1.6`
  - WARNING: **Composer**: not available
  - WARNING: **PHP**: not available
  - OK: **npm**: `8.15.0`
  - OK: **node**: `v18.7.0`
  - OK: **python3**: `Python 3.10.6`
  - OK: **pip3**: `pip 22.2.2 from /usr/local/lib/python3.10/site-packages/pip (python 3.10)`
  - WARNING: **javac**: not available
  - WARNING: **java**: not available
  - WARNING: **julia**: not available
  - OK: **wget**: `GNU Wget 1.21.3 built on darwin20.6.0.`
  - OK: **curl**: `curl 7.79.1 (x86_64-apple-darwin21.0) libcurl/7.79.1 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.11 nghttp2/1.45.1`
  - OK: **gzip**: `Apple gzip 353.100.22`
  - OK: **tar**: `bsdtar 3.5.1 - libarchive 3.5.1 zlib/1.2.11 liblzma/5.0.5 bz2lib/1.0.8 `
  - OK: **bash**: `GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin21)`
  - OK: **sh**: `Ok`
  - OK: GitHub API rate limit. Used: 0. Remaining: 60. Limit: 60. Reset: Fri Sep  2 11:38:46 2022.


### Screenshots or recordings

_No response_
@williamboman
Copy link
Owner

Hello! I am unable to reproduce this. Do you have a sample repo perhaps? I tried vue create but were unable to reproduce (it also seems like that CLI is deprecated)

@whollingsworth
Copy link
Author

whollingsworth commented Sep 21, 2022

Oh, interesting. I was following a tutorial on Vue Mastery and wasn't aware that Vue CLI was in "maintenance mode". If I create a project with vuejs/create-vue instead, the server seems to start fine. I think it's fair to close this if Vue CLI is deprecated. Thank you!

@sahibalejandro
Copy link

I've faced this error in a brand new Nuxt.js project, however it is weird that this is not happening in a regular Vue project.

The only way I could make it work was explicitly specifying the tsdk in the Volar config, example:

require'lspconfig'.volar.setup{
  init_options = {
    vue = { hybridMode = false },
    typescript = {
      tsdk = vim.fn.stdpath'data' .. '/mason/packages/typescript-language-server/node_modules/typescript/lib'
    }
  },
}

You can find more information about configuring Volar in this other issue #371
This other issue seems to be similar #74.

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