nrwl / nx-console

Nx Console is the user interface for Nx & Lerna.
https://nx.dev
MIT License
1.31k stars 211 forks source link

Language server working with IntelliJ but not with VS Code on any monorepo #1892

Closed beaussan closed 7 months ago

beaussan commented 1 year ago

Current Behavior

Nx console, since v18.6, on VS code is not able to connect to the LSP, and thus, the whole nx console is broken on VS Code. It works on Intellij, but in none of the monorepo on my computer I was able to get the nx console in vs code working.

Expected Behavior

LSP should be nice and answer back to the VS Code instead of only talking to Intellij

Steps to Reproduce

I've created the bare minimum reproduction : https://github.com/beaussan/nx-repro-vs-code-console but it fails on any nx workspace. It still works on IntelliJ but nothing on vs code. I'm afraid I don't know how to reproduce it further. Plus the logs are quite.. empty. I pasted everything I had here. If there is an additional flag I could run it with, let me know !

Failure Logs / Images / Videos

Logs inside `Nx Console Client` : ``` [Info - 22:48:12] Connection to server got closed. Server will restart. [Error - 22:48:12] Server initialization failed. Message: Pending response rejected since connection got disposed Code: -32097 [Error - 22:48:12] Nx Console Client client: couldn't create connection to server. Message: Pending response rejected since connection got disposed Code: -32097 [Error - 22:48:12] Sending request nx/workspace failed. Message: Pending response rejected since connection got disposed Code: -32097 [Error - 22:48:12] Sending request nx/version failed. Message: Pending response rejected since connection got disposed Code: -32097 [Error - 22:48:12] Sending request nx/workspace failed. Message: Pending response rejected since connection got disposed Code: -32097 [Error - 22:48:12] Sending request nx/workspace failed. Message: Pending response rejected since connection got disposed Code: -32097 [Error - 22:48:12] Sending request nx/workspace failed. Message: Pending response rejected since connection got disposed Code: -32097 [Info - 22:48:13] Connection to server got closed. Server will restart. [Error - 22:48:13] Server initialization failed. Message: Pending response rejected since connection got disposed Code: -32097 [Error - 22:48:13] Nx Console Client client: couldn't create connection to server. Message: Pending response rejected since connection got disposed Code: -32097 [Info - 22:48:14] Connection to server got closed. Server will restart. [Error - 22:48:14] Server initialization failed. Message: Pending response rejected since connection got disposed Code: -32097 [Error - 22:48:14] Nx Console Client client: couldn't create connection to server. Message: Pending response rejected since connection got disposed Code: -32097 [Error - 22:48:14] Restarting server failed Message: Pending response rejected since connection got disposed Code: -32097 [Info - 22:48:14] Connection to server got closed. Server will restart. [Error - 22:48:14] Server initialization failed. Message: Pending response rejected since connection got disposed Code: -32097 [Error - 22:48:14] Nx Console Client client: couldn't create connection to server. Message: Pending response rejected since connection got disposed Code: -32097 [Error - 22:48:14] Restarting server failed Message: Pending response rejected since connection got disposed Code: -32097 [Error - 22:48:15] The Nx Console Client server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information. [Error - 22:48:15] Server initialization failed. Message: Pending response rejected since connection got disposed Code: -32097 [Error - 22:48:15] Nx Console Client client: couldn't create connection to server. Message: Pending response rejected since connection got disposed Code: -32097 [Error - 22:48:15] Restarting server failed Message: Pending response rejected since connection got disposed Code: -32097 ```
Logs inside Nx Console tab : ``` Telemetry: production Graph - init Unable to load workspace path: Error: Pending response rejected since connection got disposed at Object.dispose (/home/beaussan/.vscode-oss/extensions/nrwl.angular-console-18.8.1-universal/main.js:695:4687) at Object.dispose (/home/beaussan/.vscode-oss/extensions/nrwl.angular-console-18.8.1-universal/main.js:702:22429) at sKe.handleConnectionClosed (/home/beaussan/.vscode-oss/extensions/nrwl.angular-console-18.8.1-universal/main.js:702:12314) at sKe.handleConnectionClosed (/home/beaussan/.vscode-oss/extensions/nrwl.angular-console-18.8.1-universal/main.js:702:26669) at n (/home/beaussan/.vscode-oss/extensions/nrwl.angular-console-18.8.1-universal/main.js:702:11994) at xJe.invoke (/home/beaussan/.vscode-oss/extensions/nrwl.angular-console-18.8.1-universal/main.js:668:14500) at iU.fire (/home/beaussan/.vscode-oss/extensions/nrwl.angular-console-18.8.1-universal/main.js:668:15270) at Mn (/home/beaussan/.vscode-oss/extensions/nrwl.angular-console-18.8.1-universal/main.js:669:6616) at xJe.invoke (/home/beaussan/.vscode-oss/extensions/nrwl.angular-console-18.8.1-universal/main.js:668:14500) at iU.fire (/home/beaussan/.vscode-oss/extensions/nrwl.angular-console-18.8.1-universal/main.js:668:15270) at eWe.fireClose (/home/beaussan/.vscode-oss/extensions/nrwl.angular-console-18.8.1-universal/main.js:668:17554) at ChildProcess. (/home/beaussan/.vscode-oss/extensions/nrwl.angular-console-18.8.1-universal/main.js:695:13493) at ChildProcess.emit (node:events:525:35) at maybeClose (node:internal/child_process:1091:16) at ChildProcess._handle.onexit (node:internal/child_process:302:5) ```

Environment

Intellij Info (healthy) ``` IntelliJ IDEA 2023.3 EAP (Ultimate Edition) Build #IU-233.8264.8, built on September 28, 2023 Licensed to IntelliJ IDEA EAP user: Nicolas Beaussart Expiration date: October 28, 2023 Runtime version: 17.0.8.1+7-b1063.1 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Linux 6.5.3-zen1-1-zen GC: G1 Young Generation, G1 Old Generation Memory: 8128M Cores: 16 Registry: debugger.new.tool.window.layout=true ide.experimental.ui=true ide.balloon.shadow.size=15 Non-Bundled Plugins: com.intellij.plugins.watcher (233.8264.3) org.jetbrains.plugins.stylus (233.8264.3) org.jetbrains.plugins.go-template (233.8264.3) name.kropp.intellij.makefile (233.8264.8) de.docs_as_co.intellij.plugin.diagramsnet (0.2.4) org.jetbrains.plugins.go (233.8264.8) AceJump (3.8.16) String Manipulation (9.11.3) com.intellij.ml.llm (233.8264.9) org.jetbrains.plugins.astro (233.8264.3) com.intellij.bigdatatools.core (233.8264.8) com.intellij.bigdatatools.binary.files (233.8264.8) com.intellij.bigdatatools.rfs (233.8264.8) dev.nx.console (1.13.1) com.intellij.lang.jsgraphql (233.8264.1) izhangzhihao.rainbow.brackets (2023.3.5) mdx.js (233.8264.3) com.mallowigi (94.0.0) mobi.hsz.idea.gitignore (4.5.1) Kotlin: 233-1.9.0-release-358-IJ8264.8 Current Desktop: i3 ```
VS code info : (broken) ``` Version: 1.82.1 Commit: 6509174151d557a81c9d0b5f8a5a1e9274db5585 Date: 2023-09-16T10:07:32.958Z Electron: 25.6.0 ElectronBuildId: undefined Chromium: 114.0.5735.134 Node.js: 18.15.0 V8: 11.4.183.23-electron.0 OS: Linux x64 6.5.3-zen1-1-zen ```
Nx repport for reproduction : ``` > NX Report complete - copy this into the issue template Node : 18.17.1 OS : linux-x64 npm : 9.6.7 nx : 16.9.1 @nx/js : 16.9.1 @nx/jest : 16.9.1 @nx/linter : 16.9.1 @nx/workspace : 16.9.1 @nx/devkit : 16.9.1 @nx/eslint-plugin : 16.9.1 @nrwl/tao : 16.9.1 typescript : 5.1.6 Done in 0.69s. ```
MaxKless commented 1 year ago

If you scroll up a bit, is there more to the error message? Maybe something like No prebuild or local build of @parcel/watcher found. or similar?

beaussan commented 1 year ago

No, unfortunately, I have already pasted the full logs that I have in the issue :(

I have tried many times to reboot vs code to see if I can have a different issue, but still have the exact same output

MaxKless commented 1 year ago

Seems like the go-to issue these days, maybe something with nvm? What does nvm list say for you?

beaussan commented 1 year ago

I don't have nvm, I use volta. Here is what volta list spits out :

❯ volta list
⚡ Currently active tools:

Node: v18.18.1 (default)
Yarn: v1.22.18 (default)
Tool binaries available:
    nbx (default)
    cloc (default)
    gitmoji (default)
    http-server (default)
    tldr (default)
MaxKless commented 1 year ago

Hey have you seen this issue that's also related to volta? https://github.com/nrwl/nx-console/issues/1802#issuecomment-1622572638 Are you using pnpm?

Otherwise it might still be a node version issue. Can you try the fix from this issue ?

There it is! 🎉 I was getting node v12.22.1 when running the node version task. To fix it, I needed to add the following to the VS Code user settings for VS Code to pick up the default node version set by Volta/NVM in the task/debug profile. "terminal.integrated.automationProfile.osx": { "path": "/bin/zsh", "args": [ "-i" ] }, Once I did that I was able to run generators without issue.

beaussan commented 7 months ago

Cannot reproduce anymore, so I guess this is fixed! ✨