nx-console: NX Console crashes when tried to be used in IntelliJ Webstorm
Current Behavior
I’m using NX v15.8.5 currently on the project. When I try to run NX Generate(UI) or open the NX Console tab with task etc. it crashes and throws this error message:
org.eclipse.lsp4j.jsonrpc.MessageIssueException: Message could not be parsed.
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleResponseIssues(RemoteEndpoint.java:358)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handle(RemoteEndpoint.java:317)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:198)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
The NX generate then just does not open at all, I’ll select a library or anything else and nothing happens.
Note: In another project, it works fine, but I can’t really check what’s missing as there is a different configuration. I assume that some of the mandatory fields might not be filled in some config files, but I could not find which ones.
Other colleagues have no issues with extension in VSCode (unfortunately I’m the only one with WebStrom atm).
Expected Behavior
NX Generate UI opens and NX Console is working.
Steps to Reproduce
I don’t have any specific configuration, everything is almost default. Here is our nx.json but it’s really default we’re just starting the project.
{
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"npmScope": "scopeName", #changed for this example
"affected": {
"defaultBase": "main"
},
"tasksRunnerOptions": {
"default": {
"runner": "nx/tasks-runners/default",
"options": {
"cacheableOperations": ["build", "lint", "test", "e2e"]
}
}
},
"targetDefaults": {
"build": {
"dependsOn": ["^build"],
"inputs": ["production", "^production"]
},
"lint": {
"inputs": ["default", "{workspaceRoot}/.eslintrc.json"]
},
"test": {
"inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"]
}
},
"namedInputs": {
"default": ["{projectRoot}/**/*", "sharedGlobals"],
"production": ["default"],
"sharedGlobals": []
},
"defaultProject": ""
}
Environment
NX report:
Node : 18.16.0
OS : darwin arm64
yarn : 1.22.19
nx : 15.8.5
@nrwl/js : 15.8.5
@nrwl/jest : 15.8.5
@nrwl/linter : 15.8.5
@nrwl/workspace : 15.8.5
@nrwl/cli : 15.8.5
@nrwl/devkit : 15.8.5
@nrwl/esbuild : 15.8.5
@nrwl/eslint-plugin-nx : 15.8.5
@nrwl/node : 15.8.5
@nrwl/nx-plugin : 15.8.5
@nrwl/tao : 15.8.5
@nrwl/webpack : 15.8.5
typescript : 5.0.4
---------------------------------------
Community plugins:
@nx/esbuild : 16.1.1
@nx/js : 16.3.2
- Nx Console version: 1.6.1
- Webstorm version: 2023.1.2
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 18
As you can see in the PR above, there will be a new action to analyze your nx config files (
project.json,nx.json) in the next release! So if you encounter this error, just runNx: Analyze Nx configuration filesto see where an error snuck in. Shouldn’t be hard to fix because if the schema is wrong in aproject.json, it’s not picked up by Nx anyways. There is also an error notification telling you if this error occurs.Closing this for now, let me know if anything else doesn’t work.
While the object might not be the way to do things anymore with the newest nx, it shouldn’t break things either. I’ll have a look at what we can do to improve the behaviour from the nx console side tomorrow 😃
Yes, CLI works just fine. I’ll have a look. Is there a list of required config fields for
project.jsonandnx.json? I think that would help a lot.Also, what you’re saying, is that it can be caused by an app
project.json? I was more looking into the general config files likenx.jsonortsconfigmaybe.Yeah that’s good that I can see the
nx/workspacerequest fails there, thanks 😃 If you run nx through the CLI, no errors appear, right? Which would show a big misconfiguration of a configuration file.Do you have some kind of comments in your
project.jsonfiles like in this issue? Similar to this #1688?It makes sense that it would be a faulty configuration somewhere because in the Kotlin environment, deserializing the workspace object is a lot pickier because it has to guarantee type-safety.