nrwl / nx-console

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

[VSCode] Nx Console cannot find any projects in my workspace #1894

Closed MJez29 closed 1 year ago

MJez29 commented 1 year ago

Current Behavior

Screenshot 2023-10-06 at 9 49 15 AM

Expected Behavior

Nx Console can find projects in my Nx workspace. nx show projects lists >20 projects

Steps to Reproduce

This is happening on a fresh install of Nx Console

Failure Logs / Images / Videos

In the Nx Console Client logs

[Nxls] - 2023-10-06T13:51:43.567Z - Unable to get nx workspace configuration: Error: Cannot find module '@nx/nx-darwin-arm64'
Require stack:
- {workspaceRoot}/node_modules/nx/src/native/index.js
- {workspaceRoot}/node_modules/nx/src/project-graph/utils/retrieve-workspace-files.js
- {workspaceRoot}/node_modules/nx/src/config/workspaces.js
- {workspaceRoot}/node_modules/nx/plugins/package-json-workspaces.js
- {workspaceRoot}/node_modules/nx/src/project-graph/utils/project-configuration-utils.js
- {workspaceRoot}/node_modules/nx/src/project-graph/build-nodes/workspace-projects.js
- {workspaceRoot}/node_modules/nx/src/project-graph/build-nodes/index.js
- {workspaceRoot}/node_modules/nx/src/project-graph/build-project-graph.js
- {workspaceRoot}/node_modules/nx/src/project-graph/project-graph.js
- {workspaceRoot}/node_modules/nx/src/project-graph/file-utils.js
- ~/.vscode/extensions/nrwl.angular-console-18.8.1/nxls/main.js

Environment

   Node   : 16.18.0
   OS     : darwin-x64
   yarn   : 1.22.19

   nx                 : 16.7.4
   @nx/js             : 16.7.4
   @nx/jest           : 16.7.4
   @nx/linter         : 16.7.4
   @nx/workspace      : 16.7.4
   @nx/devkit         : 16.7.4
   @nx/eslint-plugin  : 16.7.4
   @nx/react          : 16.7.4
   @nrwl/tao          : 16.7.4
   @nx/web            : 16.7.4
   nx-cloud           : 16.3.0
   typescript         : 5.1.3
Version: 1.82.2 (Universal)
Commit: abd2f3db4bdb28f9e95536dfa84d8479f1eb312d
Date: 2023-09-14T05:59:47.790Z
Electron: 25.8.1
ElectronBuildId: 23779380
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Darwin arm64 22.6.0
MaxKless commented 1 year ago

Hi @MJez29! Thanks for reporting this. It might have to do with your installation of nvm. There are a couple of options to fix this. Please let me know if/which of these worked:

If that doesn't work, try installing @nx/nx-darwin-arm64 as a dev dependency and check if that works.

MJez29 commented 1 year ago

Go to your default terminal (not iTerm) and change the node version there using nvm. VSCode should pick up the correct one

Which version should I change to? 16.18.0 is the only version installed on my system

If that doesn't work, try installing @nx/nx-darwin-arm64 as a dev dependency and check if that works.

I tried this and I got

error @nx/nx-darwin-arm64@16.10.0: The CPU architecture "x64" is incompatible with this module.
error Found incompatible module.
MaxKless commented 1 year ago

Can you paste the results of nvm list?

Also, sorry I misread, try installing @nx/nx-darwin-x64 instead.

MJez29 commented 1 year ago

nvm list

->     v16.18.0
default -> 16 (-> v16.18.0)
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v16.18.0) (default)
stable -> 16.18 (-> v16.18.0) (default)
lts/* -> lts/hydrogen (-> N/A)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.24.1 (-> N/A)
lts/erbium -> v12.22.12 (-> N/A)
lts/fermium -> v14.20.1 (-> N/A)
lts/gallium -> v16.18.0
lts/hydrogen -> v18.12.0 (-> N/A)

yarn why @nx/nx-darwin-x64

yarn why @nx/nx-darwin-x64
yarn why v1.22.19
[1/4] 🤔  Why do we have the module "@nx/nx-darwin-x64"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "@nx/nx-darwin-x64@16.7.4"
info Reasons this module exists
   - "_project_#nx" depends on it
   - Hoisted from "_project_#nx#@nx#nx-darwin-x64"
info Disk size without dependencies: "6.66MB"
info Disk size with unique dependencies: "6.66MB"
info Disk size with transitive dependencies: "6.66MB"
info Number of shared dependencies: 0
MaxKless commented 1 year ago

weird... definitely upgrade to at least node 18 though, node 16 isn't supported anymore

MJez29 commented 1 year ago

I tried that but I'm still seeing the issue

$ node --version
v18.18.1
MJez29 commented 1 year ago

It turns out that I had my architecture set to x64 when I installed node on my M1 (arm64). Re-installing as arm64 fixed the issue