nrwl / nx-console

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

Nx Console unable to start in VS Code #1955

Open mrvonwyl opened 7 months ago

mrvonwyl commented 7 months ago

Current Behavior

I cannot start the NX console and therefore not connect it to my workspace and use any of the functionality. There are a few errors displayed as notification and the output has issues as well.

This is probably a duplicate of https://github.com/nrwl/nx-console/issues/1891. But that one seemed stale.

Expected Behavior

I would expect the console to bring this dependecy with me, or tell me how to solve it.

Steps to Reproduce

I am not sure. It seems to be connected to the fact that the environment which I work in is running behind a firewall which blocks most of the internet traffic. I can install npm packages directly.

The console was installed through VSIX.

I think it would be reproducible, on a pristine system without internet and a new VS code installation. Then try to install the console through VSIX.

The solution is probably to manually install the watcher dependency on the system. But I would not know how this needs to be done, so Nx Console finds it.

Failure Logs / Images / Videos

NX Console VS Code errors

This output is printed several times

c:\Users\user\.vscode\extensions\nrwl.angular-console-18.10.1\node_modules\@parcel\watcher\index.js:25
      throw new Error(`No prebuild or local build of @parcel/watcher found. Tried ${name}. Please ensure it is installed (don't use --no-optional when installing with npm). Otherwise it is possible we don't support your platform yet. If this is the case, please report an issue to https://github.com/parcel-bundler/watcher.`);
      ^

Error: No prebuild or local build of @parcel/watcher found. Tried @parcel/watcher-win32-x64. Please ensure it is installed (don't use --no-optional when installing with npm). Otherwise it is possible we don't support your platform yet. If this is the case, please report an issue to https://github.com/parcel-bundler/watcher.
    at Object.<anonymous> (c:\Users\p21443\.vscode\extensions\nrwl.angular-console-18.10.1\node_modules\@parcel\watcher\index.js:25:13)
    at Module._compile (node:internal/modules/cjs/loader:1316:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1371:10)
    at Module.load (node:internal/modules/cjs/loader:1171:32)
    at Module._load (node:internal/modules/cjs/loader:1012:12)
    at f._load (node:electron/js2c/asar_bundle:2:13377)
    at Module.require (node:internal/modules/cjs/loader:1195:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Object.<anonymous> (c:\Users\p21443\.vscode\extensions\nrwl.angular-console-18.10.1\nxls\main.js:776:26973)
    at Module._compile (node:internal/modules/cjs/loader:1316:14)

Node.js v18.15.0
[Info  - 7:51:33 AM] Connection to server got closed. Server will restart.
[Error - 7:51:33 AM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 7:51:33 AM] Nx Console Client client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 7:51:33 AM] Sending request nx/workspace failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
c:\Users\p21443\.vscode\extensions\nrwl.angular-console-18.10.1\node_modules\@parcel\watcher\index.js:25
      throw new Error(`No prebuild or local build of @parcel/watcher found. Tried ${name}. Please ensure it is installed (don't use --no-optional when installing with npm). Otherwise it is possible we don't support your platform yet. If this is the case, please report an issue to https://github.com/parcel-bundler/watcher.`);
      ^

Environment

 >  NX   Report complete - copy this into the issue template

   Node   : 18.12.1
   OS     : win32-x64
   npm    : 8.19.2

   nx (global)        : 17.1.2
   nx                 : 17.1.2
   @nx/js             : 17.1.2
   @nx/jest           : 17.1.2
   @nx/linter         : 17.1.2
   @nx/eslint         : 17.1.2
   @nx/workspace      : 17.1.2
   @nx/angular        : 17.1.2
   @nx/cypress        : 17.1.2
   @nx/devkit         : 17.1.2
   @nx/eslint-plugin  : 17.1.2
   @nx/plugin         : 17.1.2
   @nrwl/tao          : 17.1.2
   @nx/web            : 17.1.2
   @nx/webpack        : 17.1.2
   typescript         : 5.2.2
   ---------------------------------------
   Community plugins:
   @ngneat/transloco        : 5.0.7
   @ngrx/effects            : 17.0.1
   @ngrx/eslint-plugin      : 17.0.1
   @ngrx/router-store       : 17.0.1
   @ngrx/signals            : 17.0.1
   @ngrx/store              : 17.0.1
   @ngrx/store-devtools     : 17.0.1
   angular-auth-oidc-client : 16.0.1
   ---------------------------------------
   Local workspace plugins:
         @my-org/docker
MaxKless commented 7 months ago

Hey! Yeah this does look similar - could you add some more info on the machine you're running on? We include @parcel/watcher prebuilds for different platforms with nx console. But in these virtualization environments, it sometimes causes issues.

The good thing is, for workspaces > 16.4, we're getting rid of @parcel/watcher entirely in favor of nx's own watcher implementation. So with the current nx console master, these issues should dissapear!

We're going to release a new version soon or you could build the master version from source today and try it!

mrvonwyl commented 7 months ago

Oh, that is good news.

What information exactly would be useful for you? I do not know any specifics. But I could ask my system administrator, if I know what to ask for.

Could you provide me with instructions on how to build the vsix myself locally? I am not familiar with vs code plugin tooling at all.

Here are some more specifics from my device settings.

Processor   Intel(R) Xeon(R) Gold 6244 CPU @ 3.60GHz   3.59 GHz  (2 processors)
Installed RAM   32.0 GB
Device ID   3B06C13C-CEBC-4FF7-B0CB-0D29A3636422
Product ID  00329-00000-00003-AA943
System type 64-bit operating system, x64-based processor
Pen and touch   No pen or touch input is available for this display
Edition     Windows 10 Enterprise
Version     22H2
Installed on    22/01/2021
OS build    19045.3570
Experience  Windows Feature Experience Pack 1000.19052.1000.0
MaxKless commented 7 months ago

It's really easy!

mrvonwyl commented 7 months ago

Thanks for the instructions @MaxKless. This worked. However, the built VSIX is in version 17.28.2. Which I would say is older than 18.10.1. This version is defined in both the root package.json and the app specific package.json on the master branch.

Am I doing something wrong?

Nevertheless, I installed the self-built plugin in my environment and there are no errors at first. However, the plugin does not seem to initialize at all and does not find a workspace. The refresh doesn't work either. Also, there is no Nx Console to choose in VS Code's OUTPUT tab.

MaxKless commented 7 months ago

yes that version is hard coded, it doesn't matter :) That's interesting... are there any errors in the developer console? You can go to Help -> Toggle Developer Console to see it.

mrvonwyl commented 7 months ago

I see. I checked the developer console. And once I saw an error that the Nx Console failed to initialized. Unfortunately, I was not able to copy it before it somehow disappeared. And I cannot reproduce it anymore. I will keep checking.

This is the exact Error when I try to refresh:

Error running command nxConsole.refreshWorkspace: command 'nxConsole.refreshWorkspace' not found. This is likely caused by the extension that contributes nxConsole.refreshWorkspace.
MaxKless commented 7 months ago

Huh when I build from master and install via .vsix, refreshing works... Maybe you need to wait a moment until it becomes available as the application bootstraps? Can you reproduce the refresh error consistently now?

clemenscodes commented 7 months ago

Having the same issue on NixOS. The bundled dependency can't be resolved and needs to be packaged seperately to NixOS, which has not happened yet. Installing the dependency globally manually requires changing the npm prefix which also defeats the purpose of nix. Manually installing the extension from master is also not feasible since the declarative approach needs a pinned version when not using latest.

Is there an ETA for the next release? @MaxKless

mrvonwyl commented 7 months ago

It seems like the Nx Console is failing to initialize. The above-mentioned error happens consistently.

Error running command nxConsole.refreshWorkspace: command 'nxConsole.refreshWorkspace' not found. This is likely caused by the extension that contributes nxConsole.refreshWorkspace.

An ETA for the next release would be appreciated.

MaxKless commented 7 months ago

Hey! Sorry people are on vacation here already so the next release will be first week of Jan :) Until then, building from source is the way to go

mrvonwyl commented 6 months ago

Update: The issue persists with v18.12.0.

Hi @MaxKless. I see that a new Version 18.11.1 was released. Well done! However, I experience the same issue as with the version I built myself before the holidays.

The workspace is not detected. There is no Output available for the nx console. And a refresh throws an error message. There is also nothing in the Developer Tools.

Annotation 2024-01-08 083937 Annotation 2024-01-08 084032 Annotation 2024-01-08 084141

MaxKless commented 4 months ago

@clemenscodes check out this writeup that might fix your NixOs issue: https://github.com/nrwl/nx-console/discussions/2051

@mrvonwyl are you sure you have the right VSCode installed for your windows version? As in x64 vs x32. It's a common mistake that often causes issues like this.

clemenscodes commented 4 months ago

@MaxKless Thanks for the heads up! Using the writeup I successfully solved this issue. :)

mrvonwyl commented 4 months ago

@MaxKless yes. My VisualStudioCode.exe is 64 bit as well as my Windows.

Here is a screenshot of the about screen of VS Code if that helps. image

MaxKless commented 3 months ago

Hey @mrvonwyl any updates on this? Can you double check whether you node is installed for the right architecture as well? It might cause an issue like this

mrvonwyl commented 3 months ago

I just tried with the latest version, 18.18.0. I still have the same behavior.

Yes, my node arch is x64 as well (checked with node -p process.arch).

HarshRajbhar commented 2 months ago

image image image Hello guys, Can you help me to solve this problem? in my case, I wanted to create angular Monorepo with nx but it didn't work. I have installed the latest angular version and node version but it didn't work can you help me?

MaxKless commented 2 months ago

Please go through the Troubleshooting Steps here: https://nx.dev/troubleshooting/troubleshoot-nx-install-issues Feel free to make a post in Discord and ping me on it if you have further questions. GitHub is for reporting issues, not so much asking for help :)