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

pyright error in mason #1868

Open
3 tasks done
Perdixky opened this issue Feb 4, 2025 · 0 comments
Open
3 tasks done

pyright error in mason #1868

Perdixky opened this issue Feb 4, 2025 · 0 comments

Comments

@Perdixky
Copy link

Perdixky commented Feb 4, 2025

I've searched open issues for similar requests

  • Yes

I've manually reviewed logs to find potential errors

  • Yes

I've recently downloaded the latest plugin version of mason.nvim

  • Yes

Problem description

when the pyright is launched, it throws out errors(in ~/.local/share/nvim/lsp.log):

[ERROR][2025-02-03 22:51:34] .../vim/lsp/rpc.lua:770	"rpc"	"/home/perdixky/.local/share/nvim/mason/bin/pyright-langserver"	"stderr"	"node:internal/modules/cjs/loader:1137\n  throw err;\n  ^\n\nError: Cannot find module '/home/perdixky/.local/share/nvim/mason/pyright/langserver.index.js'\n    at Module._resolveFilename (node:internal/modules/cjs/loader:1134:15)\n    at Module._load (node:internal/modules/cjs/loader:975:27)\n    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)\n    at node:internal/main/run_main_module:28:49 {\n  code: 'MODULE_NOT_FOUND',\n  requireStack: []\n}\n\nNode.js v18.19.1\n"

and

[ERROR][2025-02-04 20:45:45] .../vim/lsp/rpc.lua:770	"rpc"	"/home/perdixky/.local/share/nvim/mason/bin/pyright-langserver"	"stderr"	"node:internal/modules/cjs/loader:1397\n  throw err;\n  ^\n\nError: Cannot find module '/home/perdixky/.local/share/nvim/mason/pyright/langserver.index.js'\n    at Function._resolveFilename (node:internal/modules/cjs/loader:1394:15)\n    at defaultResolveImpl (node:internal/modules/cjs/loader:1050:19)\n    at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1055:22)\n    at Function._load (node:internal/modules/cjs/loader:1204:37)\n    at TracingChannel.traceSync (node:diagnostics_channel:322:14)\n    at wrapModuleLoad (node:internal/modules/cjs/loader:234:24)\n    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:151:5)\n    at node:internal/main/run_main_module:33:47 {\n  code: 'MODULE_NOT_FOUND',\n  requireStack: []\n}\n\nNode.js v23.7.0\n"

which can be reproducted by just running it in the shell

> ~/.local/share/nvim/mason/bin/pyright
node:internal/modules/cjs/loader:1397
  throw err;
  ^

Error: Cannot find module '/home/perdixky/.local/share/nvim/mason/pyright/index.js'
    at Function._resolveFilename (node:internal/modules/cjs/loader:1394:15)
    at defaultResolveImpl (node:internal/modules/cjs/loader:1050:19)
    at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1055:22)
    at Function._load (node:internal/modules/cjs/loader:1204:37)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:234:24)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:151:5)
    at node:internal/main/run_main_module:33:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v23.7.0
> ~/.local/share/nvim/mason/bin/pyright-langserver
node:internal/modules/cjs/loader:1397
  throw err;
  ^

Error: Cannot find module '/home/perdixky/.local/share/nvim/mason/pyright/langserver.index.js'
    at Function._resolveFilename (node:internal/modules/cjs/loader:1394:15)
    at defaultResolveImpl (node:internal/modules/cjs/loader:1050:19)
    at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1055:22)
    at Function._load (node:internal/modules/cjs/loader:1204:37)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:234:24)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:151:5)
    at node:internal/main/run_main_module:33:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v23.7.0

then i modified the path respectively from $basedir/../pyright/...... to $basedir/../packages/pyright/node_modules/pyright/...... and resolved the issue.

i don't know if i mad any mistakes in the installation of the package (i've already tried reinstalled pyright via mason)

Expected behavior

i want a correct way to avoid the problem

Steps to reproduce

  1. install the python language server via lazyextra
  2. open any .py file or just run ~/.local/share/nvim/mason/bin/pyright or ~/.local/share/nvim/mason/bin/pyright-langserver

Affected packages

pyright

Neovim version (>= 0.7)

NVIM v0.10.3
Build type: Release
LuaJIT 2.1.1713484068

Operating system/version

Linux Perdixky-PC 6.6.36.6-microsoft-standard-WSL2+ #1 SMP PREEMPT_DYNAMIC Sat Nov 16 14:54:26 CST 2024 x86_64 x86_64 x86_64 GNU/Linux

Healthcheck

mason.nvim [Registries] ~
- OK Registry `github.com/mason-org/mason-registry version: 2025-02-04-dull-voice` is installed.

mason.nvim [Core utils] ~
- OK unzip: `UnZip 6.00 of 20 April 2009, by Debian. Original by Info-ZIP.`
- OK wget: `GNU Wget 1.21.4 built on linux-gnu.`
- OK curl: `curl 8.5.0 (x86_64-pc-linux-gnu) libcurl/8.5.0 OpenSSL/3.0.13 zlib/1.3 brotli/1.1.0 zstd/1.5.5 libidn2/2.3.7 libpsl/0.21.2 (+libidn2/2.3.7) libssh/0.10.6/openssl/zlib nghttp2/1.59.0 librtmp/2.3 OpenLDAP/2.6.7`
- OK gzip: `gzip 1.12`
- OK tar: `tar (GNU tar) 1.35`
- OK bash: `GNU bash, version 5.2.21(1)-release (x86_64-pc-linux-gnu)`
- OK sh: `Ok`

mason.nvim [Languages] ~
- WARNING Go: not available
  - ADVICE:
    - spawn: go failed with exit code - and signal -. go 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
- WARNING luarocks: not available
  - ADVICE:
    - spawn: luarocks failed with exit code - and signal -. luarocks is not executable
- OK Ruby: `ruby 3.2.3 (2024-01-18 revision 52bb2ac0a6) [x86_64-linux-gnu]`
- OK node: `v23.7.0`
- OK cargo: `cargo 1.82.0 (8f40fc59f 2024-08-21)`
- WARNING julia: not available
  - ADVICE:
    - spawn: julia failed with exit code - and signal -. julia is not executable
- OK python: `Python 3.12.3`
- OK java: `openjdk version "21.0.5" 2024-10-15`
- OK RubyGem: `3.4.20`
- OK npm: `10.9.2`
- OK javac: `javac 21.0.5`
- OK pip: `pip 24.0 from /usr/lib/python3/dist-packages/pip (python 3.12)`
- OK python venv: `Ok`

mason.nvim [GitHub] ~
- OK GitHub API rate limit. Used: 0. Remaining: 60. Limit: 60. Reset: Tue Feb  4 22:39:26 2025.
  Install and authenticate via gh-cli to increase rate limit.

Screenshots or recordings

No response

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

1 participant