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

"Couldn't start client Yang Language Server" on windows #95

Open
hujun-open opened this issue Sep 6, 2024 · 7 comments
Open

"Couldn't start client Yang Language Server" on windows #95

hujun-open opened this issue Sep 6, 2024 · 7 comments
Labels

Comments

@hujun-open
Copy link

Yangster version: 2.3.2
vscode: 1.93.0
OS: windows 11

[Error - 1:53:34 PM] Starting client failed
Error: spawn EINVAL
at ChildProcess.spawn (node:internal/child_process:421:11)
at Object.spawn (node:child_process:800:9)
at c:\Users\junhu.vscode\extensions\typefox.yang-vscode-2.3.2\extension\pack\extension.js:1:92428

I tried with openjdk 11, 21, 22, microsoft build openjdk, oracle jdk, same error

but it works fine if use vscode with WSL2 (e.g. open YANG file in WSL), with openjdk 11 installed in WSL2

@andre-brizido
Copy link

I have the same problem on windows and with
OpenJDK 64-Bit Server VM Microsoft-7208460 (build 11.0.18+10-LTS, mixed mode),
VS CODE 1.93.1
latest yangster version available

@vinsworldcom
Copy link

Could this be the issue:

nodejs/node#52681
nodejs/node#52554

Needs {shell: true} - I tried adding this but I don't really know what I'm doing. Also tried to launch something other than yang-language-server.bat to no avail.

Cheers.

@vinsworldcom
Copy link

vinsworldcom commented Oct 18, 2024

I seem to have fixed this. First off, need a file in:

%USERPROFILE%\.yang\yang.settings:

{
    "yangPath": "/usr/share/yang/modules"
}

Where the path is the root of your Yang modules locations. For me, they are in 'C:\usr\share\yang\modules', but I'm using the "unix"-like path which seems to work fine.

Next, you need to add the {shell:true} to the 'extension.js' file, slightly before position 92366 (for me) or where ever the error line:

at c:\Users\junhu.vscode\extensions\typefox.yang-vscode-2.3.2\extension\pack\extension.js:1:92428

indicates. There, you'll find:

r=Object.assign({},t.options);

I changed that to:

r=Object.assign({shell:true},t.options);

And now the plugin shows the function outlines and creates diagrams!

Cheers.

@dhuebner dhuebner added the bug label Oct 25, 2024
@dhuebner
Copy link
Member

@vinsworldcom
Thanks for investigation. Seems to be a Windows issue, right? I'm on mac and will need some time to get a fix ready.

@vinsworldcom
Copy link

@dhuebner , yes, from the 2 Node.js links I reference above, seems a new Node.js setting prevents it from launching Windows .bat or .cmd files directly without setting the {shell: true} property. Assuming somewhere along the recent VSCode upgrades, it started using this new Node.js version as I remember Yangster working fine for me last year and when I returned to it this year (more NETCONF/YANG work popped up), it was "broke".

Not sure you need to worry about the 'yang.settings' file, but it may be nice to make note of that in the README so Windows users know what file to create at what directory path for the Language Server to validate.

I've been happily working with my fix above for a week or so with no ill effects. Of course, not sure of the "proper" way to fix this as I'm not a VSCode extension author or even know much about it.

Cheers.

@dhuebner
Copy link
Member

@vinsworldcom
The problem is that we are not launching processes directly, it must be one of the dependencies that need to be updated I think.

@vinsworldcom
Copy link

The problem is that we are not launching processes directly

Not sure what that means. Who creates the file:

%USERPROFILE%\extensions\typefox.yang-vscode-2.3.2\extension\pack\extension.js

Isn't that from this plugin? That is the file that I'm editing and that is the file that is launching the ".vscode\extensions\typefox.yang-vscode-2.3.3\server\bin\yang-language-server.bat" file. Launching that BAT file is what is generating the error - unless you make the {shell: true} edit to the the 'extension.js' file I indicate above.

Cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants