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 Console is empty #1197

Closed
ecohanim opened this issue Dec 15, 2021 · 49 comments
Closed

Nx Console is empty #1197

ecohanim opened this issue Dec 15, 2021 · 49 comments
Assignees

Comments

@ecohanim
Copy link

ecohanim commented Dec 15, 2021

i am using nx console on vscode, it stopped working recently after the recent changes of using nx tools to parse nx.json
my vscode is installed on windows 10 and my project is on wsl2
everything was working fine till the recent updates of nx console
see image below for the error i am getting on the output tab as well as the error popup window on the bottom right

image

@Cammisuli Cammisuli self-assigned this Dec 15, 2021
@Cammisuli
Copy link
Member

Does the error still happen when you open https://GitHub.com/nrwl/nx-examples?

Also can I get the contents of your package.json please

@stepanic
Copy link

@Cammisuli I also have the same error :/

Screenshot 2021-12-15 at 23 52 59

Installed Extension version 17.13.1

@stepanic
Copy link

I think that bug was introduced in version 17.13.0 because when I roll back to 17.12.4, the extension works.
Screenshot 2021-12-15 at 23 57 39

@Cammisuli
Copy link
Member

A few folks are having the issue but I can't reproduce it with any repo I have ☹️

Does everything work well with the nx-examples repo?

@Cammisuli
Copy link
Member

potentially fixed with #1199 where it will release as 17.13.2

@marcellkiss
Copy link

I think that bug was introduced in version 17.13.0 because when I roll back to 17.12.4, the extension works. Screenshot 2021-12-15 at 23 57 39

I had the same problem, and downgrading solved the issue. Thanks for the advice @stepanic

@Cammisuli
Copy link
Member

Can everyone try the latest version 17.13.2? Then report back to see if that solved something?

@miskith
Copy link

miskith commented Dec 17, 2021

Tried with 17.13.2, still doesn't work. I am using two environments - windows filesystem & wsl2. For windows filesystem everything works as expected, for wsl2 it doesn't. Reverting to version before 17.13.x "fixes" the issue. None of the versions 17.13.x work.

@miskith
Copy link

miskith commented Dec 17, 2021

Update: Tried provided nx-examples and that one works. So tried to copy non-functional repos to windows filesystem and also does not work there O.o. After comparing why some repos work and some not, I came to conclusion, that problem may be when trying to open monorepos. So tried to open non functional project in wsl2 in such a way that angular.json is in the root and it did work. So probably problem is when opening monorepos?

@marcellkiss
Copy link

marcellkiss commented Dec 17, 2021

I can confirm, 17.13.2 didn't help, it breaks down again (after upgrading from 17.12.4)
(MacOS Monterey)

@Cammisuli
Copy link
Member

So is everyone opening sub folders from the main workspace?

@Cammisuli
Copy link
Member

@miskith Do you have an example of a repo that you're experiencing the issue with?

Or exact instructions on how you're reproducing it?

@miskith
Copy link

miskith commented Dec 17, 2021

@Cammisuli Sorry, can't provide you with repo as those are private projects. But basically this command should do the magic (tested it for me on Windows and WSL2, for both broken):
mkdir test && cd test && git clone https://github.com/nrwl/nx-examples.git && code .
The goal is to open VSCode at least one directory above.

@Cammisuli
Copy link
Member

@miskith opening in a directory above worked before? 😮

@Cammisuli
Copy link
Member

If that's the case can you then just select the child workspace with this item?
image

Nx Console always searched in parent directories by default to find a workspace. If a workspace isn't in the parent directories, the menu item I mention should help with setting the correct child workspace. Then if you reopen the same directory in VSCode, it should remember your last manually selected workspace.

@Cammisuli
Copy link
Member

AHH! I know what could be the issue now... We have these activationEvents triggers:

"activationEvents": [
"onView:nx-console",
"workspaceContains:workspace.json",
"workspaceContains:angular.json",
"workspaceContains:nx.json"
],

But I don't believe onView:nx-console works for non-built-in views. I can change that to onStartupFinished so the extension always activates.

@miskith
Copy link

miskith commented Dec 17, 2021

Yes, as I said, after reverting to version before 17.13.x , it worked well. Changing workspace doesnt work the whole nx window is empty (sorry, just noticed my issue is a bit different than original issue as @ecohanim sees at least something in the window). This is how it looks for me with new version:
image
and same repo version 17.12.4
image

@Cammisuli
Copy link
Member

Let's try again with 17.13.3. It's being built and released now 😅

@miskith
Copy link

miskith commented Dec 17, 2021

Cool, so can't speak for others, but for me 17.3.3 fixed it. I had to load correct workspace through "Change workspace" button, but that is fine, at least it works :). And after VS Code restart it remembers the previously set workspace, just as you said.

@Cammisuli
Copy link
Member

Ok I'll wait for others to speak up before closing this issue.

@ianvink
Copy link

ianvink commented Dec 17, 2021

I can confirm 17.3.3 now works, but only after I manually selected the Workspace. 17.2.x would do that automatically.

...and thank you for a wonderful service BTW

image

@ecohanim
Copy link
Author

ecohanim commented Dec 20, 2021

still not working for me, having the below error

image

and change workspace button doesn't help in my case
when downgrading to 17.12.4 it works fine

@Cammisuli
Copy link
Member

@ecohanim im not sure if you did this already, but can I get the contents of your package.json file?

@ecohanim
Copy link
Author

@ecohanim im not sure if you did this already, but can I get the contents of your package.json file?

not sure i can publish it. is there something specific you need from that file?

@Cammisuli
Copy link
Member

Just the dependencies and devDependencies

@ecohanim
Copy link
Author

ecohanim commented Dec 20, 2021

Just the dependencies and devDependencies

sorry, i cant publish that file

@kyleryanbanks
Copy link

kyleryanbanks commented Dec 20, 2021

17.12.x works for us but not anything over 17.13.x (including 17.13.3)

We haven't done our yearly upgrade cycle yet so we're still on v10. Haven't had any issue with console previously.

"dependencies": {
"@angular/animations": "10.2.5",
"@angular/cdk": "10.2.2",
"@angular/common": "10.2.5",
"@angular/compiler": "10.2.5",
"@angular/core": "10.2.5",
"@angular/forms": "10.2.5",
"@angular/localize": "10.2.5",
"@angular/platform-browser": "10.2.5",
"@angular/platform-browser-dynamic": "10.2.5",
"@angular/platform-server": "10.2.5",
"@angular/router": "10.2.5",
"@ng-bootstrap/ng-bootstrap": "7.0.0",
"@ng-idle/core": "10.0.0-beta.1",
"@ngrx/effects": "10.1.2",
"@ngrx/entity": "10.1.2",
"@ngrx/router-store": "10.1.2",
"@ngrx/store": "10.1.2",
"@nguniversal/common": "10.1.0",
"@nguniversal/express-engine": "10.1.0",
"@nrwl/angular": "10.4.15",
"angular2-text-mask": "9.0.0",
"body-scroll-lock": "3.1.3",
"css-vars-ponyfill": "^1.7.2",
"domino": "^2.1.6",
"express": "^4.15.2",
"http-server": "^0.12.3",
"inquirer": "^6.5.2",
"intl": "^1.2.5",
"localstorage-polyfill": "^1.0.1",
"lodash": "^4.17.21",
"minimist": "^1.2.5",
"moment": "^2.24.0",
"moment-timezone": "^0.5.27",
"ng-http-loader": "8.0.0",
"ngx-cookie": "5.0.0",
"ngx-moment": "^3.5.0",
"oidc-client": "^1.10.1",
"print-js": "^1.0.63",
"rxjs": "6.5.5",
"web-animations-js": "^2.3.2",
"winston": "^3.3.3",
"winston-daily-rotate-file": "^4.5.0",
"xmlhttprequest": "^1.8.0",
"zone.js": "0.10.3"
},
"devDependencies": {
"@angular-devkit/build-angular": "0.1002.3",
"@angular/cli": "10.2.3",
"@angular/compiler-cli": "10.2.5",
"@angular/language-service": "10.2.5",
"@babel/core": "^7.14.6",
"@compodoc/compodoc": "1.1.11",
"@ngrx/schematics": "10.1.2",
"@ngrx/store-devtools": "10.1.2",
"@nguniversal/builders": "10.1.0",
"@nrwl/cli": "10.4.15",
"@nrwl/jest": "10.4.15",
"@nrwl/storybook": "10.4.15",
"@nrwl/workspace": "10.4.15",
"@storybook/addon-a11y": "6.0.28",
"@storybook/addon-essentials": "6.0.28",
"@storybook/angular": "6.0.28",
"@storybook/client-api": "6.0.28",
"@types/express": "4.17.7",
"@types/fs-extra": "^5.0.4",
"@types/jest": "25.1.4",
"@types/lodash": "4.14.108",
"@types/node": "~8.9.4",
"@types/webpack": "4.41.21",
"bootstrap": "4.5.0",
"codelyzer": "6.0.0-next.2",
"concurrently": "5.3.0",
"core-js": "^3.14.0",
"cross-spawn": "7.0.3",
"dotenv": "6.2.0",
"istanbul-api": "^2.1.6",
"istanbul-combine-updated": "^0.3.0",
"jest": "25.2.4",
"jest-canvas-mock": "^2.2.0",
"jest-preset-angular": "8.1.3",
"jquery": "3.6.0",
"kss": "^3.0.1",
"michelangelo": "^0.8.0",
"ng-packagr": "10.1.2",
"node-dir": "^0.1.17",
"node-sass": "^4.14.1",
"opn": "^5.5.0",
"prettier": "2.0.5",
"recursive-readdir": "^2.2.2",
"storybook-addon-designs": "^6.0.0",
"ts-jest": "25.5.1",
"ts-node": "^7.0.1",
"tslint": "6.0.0",
"typescript": "3.9.7",
"uuid": "^8.3.1",
"webpack-bundle-analyzer": "^3.7.0",
"webpack-cli": "^3.1.0"
}

image

@GrumpyMeow
Copy link

I also have the same issue in my WSL2 environment. In the output window i get this message:
` Error loading @nrwl/workspace from workspace. Falling back to extension dependency
Error: Error: Cannot find module '/home/me/dummy/.vscode/node_modules/@nrwl/workspace/src/core/file-utils.js'
Require stack:

  • /home/me/.vscode-server/extensions/nrwl.angular-console-17.13.3/main.js
  • /home/me/.vscode-server/bin/899d46d82c4c95423fb7e10e68eba52050e30ba3/out/vs/loader.js
  • /home/me/.vscode-server/bin/899d46d82c4c95423fb7e10e68eba52050e30ba3/out/bootstrap-amd.js
  • /home/me/.vscode-server/bin/899d46d82c4c95423fb7e10e68eba52050e30ba3/out/bootstrap-fork.js
    `
    We are using NX v12 still..

@Cammisuli
Copy link
Member

Thank you @kyleryanbanks! I was able to reproduce it with your dependencies. I pushed up a PR with a fix. Hopefully that fixes it up for everyone 😓

@Cammisuli
Copy link
Member

For everyone else, 17.13.4 is being built and released. If you all can try again with that, and let me know if that works out please 😅

@ecohanim
Copy link
Author

ecohanim commented Dec 21, 2021

For everyone else, 17.13.4 is being built and released. If you all can try again with that, and let me know if that works out please 😅

having new error now after updating to the latest version
(basically i now see "nx common commands" and "generate and run target", they are not working because "projects" list is empty and also the below error is being presented on the bottom right)

image

@Cammisuli
Copy link
Member

@ecohanim its hard to debug yours because I can't reproduce your use case. I'd either need the dependencies of your package.json or a reproduction in another repo 🙁

@GrumpyMeow
Copy link

I just installed v17.13.4 and get this error:
Nx Console encountered an error when activating TypeError: Cannot convert undefined or null to object at Function.keys (<anonymous>) at L (/home/me/.vscode-server/extensions/nrwl.angular-console-17.13.4/main.js:1:45611) at /home/me/.vscode-server/extensions/nrwl.angular-console-17.13.4/main.js:1:50954 at async Promise.all (index 0) at async /home/me/.vscode-server/extensions/nrwl.angular-console-17.13.4/main.js:1:50714 at async Q (/home/me/.vscode-server/extensions/nrwl.angular-console-17.13.4/main.js:1:50507) at async H (/home/me/.vscode-server/extensions/nrwl.angular-console-17.13.4/main.js:1:50384) at async /home/me/.vscode-server/extensions/nrwl.angular-console-17.13.4/main.js:1:38512 at async le (/home/me/.vscode-server/extensions/nrwl.angular-console-17.13.4/main.js:1:38171) at async pe (/home/me/.vscode-server/extensions/nrwl.angular-console-17.13.4/main.js:1:32727) at async Promise.all (index 0)

Output of: npx nx report
`

NX Report complete - copy this into the issue template

Node : 14.17.0
OS : linux x64
npm : 6.14.13

nx : 12.10.0
@nrwl/angular : 12.10.0
@nrwl/cli : 12.10.0
@nrwl/cypress : 12.10.0
@nrwl/devkit : 12.10.0
@nrwl/eslint-plugin-nx : 12.10.0
@nrwl/express : 12.10.0
@nrwl/jest : 12.10.0
@nrwl/linter : 12.10.0
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : 12.10.0
@nrwl/nx-cloud : Not Found
@nrwl/react : Not Found
@nrwl/schematics : Not Found
@nrwl/tao : 12.10.0
@nrwl/web : 12.10.0
@nrwl/workspace : 12.10.0
@nrwl/storybook : 12.10.0
@nrwl/gatsby : Not Found
typescript : 4.3.5
`

@kyleryanbanks
Copy link

@Cammisuli I tried 17.13.4 and I'm getting the same issue as @ecohanim.

Error loading @nrwl/workspace from workspace. Falling back to extension dependency
Error: Workspace tools does not have `readWorkspaceConfig` function. Use built in @nrwl/workspace package

This is actually getting output now at least, before is was just the empty {}.

Everything seems to load fine until it tries to load the projects. We're still back on the pre-workspace config v10 at the moment, so I assume it's just not loading from the right config?

@Cammisuli
Copy link
Member

That could be it. I just installed the dependencies that was mentioned earlier in the nx examples repo and saw the issue you first mentioned.

I'll try again with a fresh v10 workspace with npx create-nx-workspace@v10

@Cammisuli
Copy link
Member

Can you all try 17.13.5 please and ty 🙏🏼

@kyleryanbanks
Copy link

Hey @Cammisuli, that last fix seems to have gotten it running again for us.

Thanks for all the help.

@ecohanim
Copy link
Author

seem to be working at my env as well :)
thanks a lot for the effort

@Cammisuli
Copy link
Member

Yay! Thanks everyone for your patience in getting this fixed. Now I'm going to go on vacation 😪😮‍💨

@labeled
Copy link

labeled commented Dec 22, 2021

We updated this morning and can see the projects but have no expandability.
image
The output window for NX Console has this error for every app / lib in our repo
image
**Update - Version 17.13.4 worked for us, 17.13.5 does not. (windows 10)

@kyleryanbanks
Copy link

Just adding information, projects expand fine for us on the .5 update.

@Cammisuli
Copy link
Member

@labeled can you create a new issue with your workspace info (nx report output or package.json dependencies, please and thank you

@Cammisuli
Copy link
Member

@labeled I actually found out what could be the issue and I'm going to release a new version soon.

@labeled
Copy link

labeled commented Dec 23, 2021

@labeled I actually found out what could be the issue and I'm going to release a new version soon.

@Cammisuli If you would like I could pull down your branch and test locally before you commit to master.
I was debugging it myself, we use the standalone config. So our 'projectDef' is a string (in nx-project-tree-). I think in normal cases it's an object but with the standalone config they're all strings
image

@Cammisuli
Copy link
Member

Cammisuli commented Dec 23, 2021

@labeled yup, that's what I found in one of the repos I had. I thought that standalone config were introduced with Nx 13, but they were there for 12. So I just had to change the minimum version to be less than 12, instead of less than 13 to use just regular old read json.

If 17.13.6 doesn't work for you, can you open a new issue please?

@labeled
Copy link

labeled commented Dec 23, 2021

That resolved it! Much appreciated sir :)

@vire
Copy link

vire commented Nov 7, 2022

I have the same issue - nx console empty with v17.24.2

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

@Cammisuli
Copy link
Member

That looks like a typical VSCode error. If you hard close vscode and reopen it, it should be fixed. If not, please make a new issue.

@vire vire mentioned this issue Nov 7, 2022
@andrevilmo
Copy link

Hello, people ..
This problem soles to me on install and save locally:
npm install --save

@nrwl nrwl locked as resolved and limited conversation to collaborators Dec 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests