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

Nx Language Server Quits on Startup Without core-js module installed #2019

Open
Drew-Daniels opened this issue Feb 7, 2024 · 2 comments
Open
Labels
type: bug Something isn't working

Comments

@Drew-Daniels
Copy link

Current Behavior

I am using neovim as my editor, mason as my package manager, and nvim-lspconfig to hook my LSP servers into neovim.

After installing nxls with mason, and configuring neovim to use nxls as a language server for .json files, when I open an nx.json file (or any .json file now), I see an error message stating that nxls failed to start.

When I look at the logs, I see that the reason it failed is because it cannot find the core-js module.

[ERROR][2024-02-06 20:47:20] .../vim/lsp/rpc.lua:31	"rpc"	"/Users/drew/.local/share/nvim/mason/bin/nxls"	"stderr"	"node:internal/modules/cjs/loader:1147\n  throw err;\n  ^\n\nError: Cannot find module 'core-js/modules/es.regexp.to-string.js'\nRequire stack:\n- /Users/drew/.local/share/nvim/mason/packages/nxls/node_modules/nxls/main.js\n- /Users/drew/.local/share/nvim/mason/packages/nxls/node_modules/nxls/bin/nxls\n    at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)\n    at Module._load (node:internal/modules/cjs/loader:985:27)\n    at Module.require (node:internal/modules/cjs/loader:1235:19)\n    at require (node:internal/modules/helpers:176:18)\n    at /Users/drew/.local/share/nvim/mason/packages/nxls/node_modules/nxls/main.js:1:866\n    at /Users/drew/.local/share/nvim/mason/packages/nxls/node_modules/nxls/main.js:1:39087\n    at Object.<anonymous> (/Users/drew/.local/share/nvim/mason/packages/nxls/node_modules/nxls/main.js:1:39193)\n    at Module._compile (node:internal/modules/cjs/loader:1376:14)\n    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)\n    at Module.load (node:internal/modules/cjs/loader:1207:32) {\n  code: 'MODULE_NOT_FOUND',\n  requireStack: [\n    '/Users/drew/.local/share/nvim/mason/packages/nxls/node_modules/nxls/main.js',\n    '/Users/drew/.local/share/nvim/mason/packages/nxls/node_modules/nxls/bin/nxls'\n  ]\n}\n\nNode.js v20.11.0\n"

I do not see this listed anywhere in the dependencies section of nxls, and can see that the only packages that explicitly require it are @storybook/addon-knobs and @wdio/devtools-service.

image

However, when I look at nxls/node_modules/.bin/nxls, which is the executable I have neovim pointed to as the language server for nx files, I can see that it requires nxls/main.js, which in turn requires core-js/modules/es.regexp.to-string.js:

image

Expected Behavior

I would expect that by downloading nxls, all of it's required dependencies are installed.

Steps to Reproduce

  • Configure neovim as I have here
  • Run :MasonInstallAll in neovim to install all packages (includesnxls)
  • Open a .json file with neovim:
$ nvim test.json
  • See that you get an error message stating "Client nxls quit with exit code 1 and signal 0..."

image

Environment

OS: MacOS Sonoma 14.2.1 (23C71)
Neovim:

NVIM v0.10.0-dev-2294+gc0b99bb1d-Homebrew
Build type: Release
LuaJIT 2.1.1703358377
Run "nvim -V1 -v" for more info
  • Nx Console version: N/A
  • VSCode version: N/A
@Drew-Daniels Drew-Daniels added the type: bug Something isn't working label Feb 7, 2024
@Cammisuli
Copy link
Member

yea, you're right. Nxls doesnt have core-js as a dependency. I think we might have to release a newer version of nxls to npm, we havent done that in a while. Sorry about that!

@Drew-Daniels
Copy link
Author

No worries! Thanks for taking a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants