valentjn / vscode-ltex

LTeX: Grammar/spell checker :mag::heavy_check_mark: for VS Code using LanguageTool with support for LaTeX :mortar_board:, Markdown :pencil:, and others
https://valentjn.github.io/ltex
Mozilla Public License 2.0
817 stars 29 forks source link

Did not work on Windows, JAVA problem #886

Open milen-prg opened 3 months ago

milen-prg commented 3 months ago

When install on VSCode (Windows 11 Pro 64 bit, all updated) and open a file - error message:

Could not run ltex-ls with Java, please see the output panel 'LTeX Language Client' for details. You might want to try offline installation.

2024-08-11T16:59:05.110Z Info: Setting LTeX UI language to 'en'. 2024-08-11T16:59:05.110Z Info: Loading i18n messages... 2024-08-11T16:59:05.110Z Info: Loading default i18n messages... 2024-08-11T16:59:05.112Z Info: 2024-08-11T16:59:05.112Z Info: ltex.ltex-ls.path not set. 2024-08-11T16:59:05.112Z Info: Searching for ltex-ls in 'c:\Users\User.vscode\extensions\neo-ltex.ltex-13.1.1\lib'... 2024-08-11T16:59:05.112Z Info: ltex-ls found in 'c:\Users\User.vscode\extensions\neo-ltex.ltex-13.1.1\lib\ltex-ls-15.2.0'. 2024-08-11T16:59:05.112Z Info: 2024-08-11T16:59:05.112Z Info: Using ltex-ls from 'c:\Users\User.vscode\extensions\neo-ltex.ltex-13.1.1\lib\ltex-ls-15.2.0'. 2024-08-11T16:59:05.112Z Info: Using Java bundled with ltex-ls as ltex.java.path is not set. 2024-08-11T16:59:05.113Z Info: Testing ltex-ls... 2024-08-11T16:59:05.113Z Info: Command: "c:\Users\User\.vscode\extensions\neo-ltex.ltex-13.1.1\lib\ltex-ls-15.2.0\bin\ltex-ls.bat" 2024-08-11T16:59:05.113Z Info: Arguments: ["--version"] 2024-08-11T16:59:05.113Z Info: env['JAVA_HOME']: undefined 2024-08-11T16:59:05.113Z Info: env['JAVA_OPTS']: "-Xms64m -Xmx512m" 2024-08-11T16:59:05.113Z Error: Test failed. 2024-08-11T16:59:05.113Z Error: Error details: 2024-08-11T16:59:05.119Z Error: Error: spawnSync c:\Users\User.vscode\extensions\neo-ltex.ltex-13.1.1\lib\ltex-ls-15.2.0\bin\ltex-ls.bat EINVAL 2024-08-11T16:59:05.119Z Error: at Object.spawnSync (node:internal/child_process:1124:20) 2024-08-11T16:59:05.119Z Error: at Object.spawnSync (node:child_process:914:24) 2024-08-11T16:59:05.119Z Error: at DependencyManager. (c:\Users\User.vscode\extensions\neo-ltex.ltex-13.1.1\dist\extension.js:14956:45) 2024-08-11T16:59:05.119Z Error: at Generator.next () 2024-08-11T16:59:05.119Z Error: at fulfilled (c:\Users\User.vscode\extensions\neo-ltex.ltex-13.1.1\dist\extension.js:14587:58) 2024-08-11T16:59:05.119Z Info: ltex-ls did not print expected version information to stdout. 2024-08-11T16:59:05.119Z Info: stdout of ltex-ls: 2024-08-11T16:59:05.119Z Info: 2024-08-11T16:59:05.119Z Info: stderr of ltex-ls: 2024-08-11T16:59:05.119Z Info: 2024-08-11T16:59:05.120Z Info: You might want to try offline installation, see https://valentjn.github.io/vscode-ltex/docs/installation-and-usage.html#offline-installation.

The offline installation is successful, but nothing changes.

pearj commented 3 months ago

I noticed this problem too. It was working last week, so I'm guessing a recent update to VS Code broke something. I tried using the offline installation, but it didn't help either. Curiously running the --version command from cmd.exe actually works. So it's a problem with how the extension launches the command it seems.

C:\Users\joel>c:\Users\joel\.vscode\extensions\valentjn.vscode-ltex-13.1.0\lib\ltex-ls-15.2.0\bin\ltex-ls.bat --version
{
  "ltex-ls": "15.2.0",
  "java": "11.0.12"
}
watanabe-j commented 3 months ago

Perhaps is this a duplicate of #884? I had the same problem, but the patch solution suggested there seems to have worked for me.

miltonra commented 3 months ago

Same problem I guess. Tried setting ltex.java.path manually, to no avail. Tried offline installation, which resulted in: 2024-08-12T18:32:01.480Z Info: Setting LTeX UI language to 'en'. 2024-08-12T18:32:01.481Z Info: Loading i18n messages... 2024-08-12T18:32:01.481Z Info: Loading default i18n messages... 2024-08-12T18:32:01.483Z Info: 2024-08-12T18:32:01.484Z Info: ltex.ltex-ls.path not set. 2024-08-12T18:32:01.484Z Info: Searching for ltex-ls in 'c:\Users\fc1ram.vscode\extensions\valentjn.vscode-ltex-13.1.0\lib'... 2024-08-12T18:32:01.484Z Info: ltex-ls found in 'c:\Users\fc1ram.vscode\extensions\valentjn.vscode-ltex-13.1.0\lib\ltex-ls-15.2.0'. 2024-08-12T18:32:01.484Z Info: 2024-08-12T18:32:01.484Z Info: Using ltex-ls from 'c:\Users\fc1ram.vscode\extensions\valentjn.vscode-ltex-13.1.0\lib\ltex-ls-15.2.0'. 2024-08-12T18:32:01.484Z Info: Using Java bundled with ltex-ls as ltex.java.path is not set. 2024-08-12T18:32:01.484Z Info: Testing ltex-ls... 2024-08-12T18:32:01.484Z Info: Command: "c:\Users\fc1ram\.vscode\extensions\valentjn.vscode-ltex-13.1.0\lib\ltex-ls-15.2.0\bin\ltex-ls.bat" 2024-08-12T18:32:01.484Z Info: Arguments: ["--version"] 2024-08-12T18:32:01.484Z Info: env['JAVA_HOME']: undefined 2024-08-12T18:32:01.484Z Info: env['JAVA_OPTS']: "-Xms64m -Xmx512m" 2024-08-12T18:32:01.485Z Error: Test failed. 2024-08-12T18:32:01.485Z Error: Error details: 2024-08-12T18:32:01.487Z Error: Error: spawnSync c:\Users\fc1ram.vscode\extensions\valentjn.vscode-ltex-13.1.0\lib\ltex-ls-15.2.0\bin\ltex-ls.bat EINVAL 2024-08-12T18:32:01.487Z Error: at Object.spawnSync (node:internal/child_process:1124:20) 2024-08-12T18:32:01.487Z Error: at Object.spawnSync (node:child_process:914:24) 2024-08-12T18:32:01.487Z Error: at DependencyManager. (c:\Users\fc1ram.vscode\extensions\valentjn.vscode-ltex-13.1.0\dist\extension.js:13528:45) 2024-08-12T18:32:01.487Z Error: at Generator.next () 2024-08-12T18:32:01.487Z Error: at fulfilled (c:\Users\fc1ram.vscode\extensions\valentjn.vscode-ltex-13.1.0\dist\extension.js:13159:58) 2024-08-12T18:32:01.487Z Info: ltex-ls did not print expected version information to stdout. 2024-08-12T18:32:01.487Z Info: stdout of ltex-ls: 2024-08-12T18:32:01.487Z Info: 2024-08-12T18:32:01.487Z Info: stderr of ltex-ls: 2024-08-12T18:32:01.487Z Info: 2024-08-12T18:32:01.487Z Info: You might want to try offline installation, see https://valentjn.github.io/vscode-ltex/docs/installation-and-usage.html#offline-installation.

Hope this helps.

wellebeSICKAG commented 3 months ago

This issue is because VS Code updated Node.js which includes this security fix: https://nodejs.org/en/blog/vulnerability/april-2024-security-releases-2 There is some documentation on starting shell processes here: https://nodejs.org/api/child_process.html#spawning-bat-and-cmd-files-on-windows And some discussion about it here: https://github.com/nodejs/node/issues/52554

It can be fixed (not sure if this is a safe fix though). By replacing the executableOptions in extension.js (starting line 13618) with:

              const executableOptions = {
                encoding: 'utf-8',
                timeout: 15000,
                shell: true
              };

This is also a duplicate of issue #884

musm commented 1 month ago

Thanks @wellebeSICKAG was able to fix it using that patch

mark1spec commented 1 month ago

UPDATE: I just found a working fork of this repository (VSCode plugin) which solves the issue on Windows: LTeX+

I can confirm the same problem on Windows 11 and VSCode 1.94.2. I tried:

Still no luck. Feel free to request more info.

Just in case my log file:

2024-10-12T16:59:09.708Z Info: ltex.ltex-ls.path not set. 2024-10-12T16:59:09.708Z Info: Searching for ltex-ls in 'c:\Users\Mariusz\.vscode\extensions\valentjn.vscode-ltex-13.1.0\lib'... 2024-10-12T16:59:09.708Z Info: ltex-ls found in 'c:\Users\Mariusz\.vscode\extensions\valentjn.vscode-ltex-13.1.0\lib\ltex-ls-15.2.0'. 2024-10-12T16:59:09.708Z Info: 2024-10-12T16:59:09.708Z Info: Using ltex-ls from 'c:\Users\Mariusz\.vscode\extensions\valentjn.vscode-ltex-13.1.0\lib\ltex-ls-15.2.0'. 2024-10-12T16:59:09.708Z Info: Using Java bundled with ltex-ls as ltex.java.path is not set. 2024-10-12T16:59:09.709Z Info: Testing ltex-ls... 2024-10-12T16:59:09.709Z Info: Command: "c:\\Users\\Mariusz\\.vscode\\extensions\\valentjn.vscode-ltex-13.1.0\\lib\\ltex-ls-15.2.0\\bin\\ltex-ls.bat" 2024-10-12T16:59:09.709Z Info: Arguments: ["--version"] 2024-10-12T16:59:09.709Z Info: env['JAVA_HOME']: undefined 2024-10-12T16:59:09.709Z Info: env['JAVA_OPTS']: "-Xms64m -Xmx512m" 2024-10-12T16:59:09.710Z Error: Test failed. 2024-10-12T16:59:09.710Z Error: Error details: 2024-10-12T16:59:09.714Z Error: Error: spawnSync c:\Users\Mariusz\.vscode\extensions\valentjn.vscode-ltex-13.1.0\lib\ltex-ls-15.2.0\bin\ltex-ls.bat EINVAL 2024-10-12T16:59:09.714Z Error: at Object.spawnSync (node:internal/child_process:1124:20) 2024-10-12T16:59:09.714Z Error: at Object.spawnSync (node:child_process:910:24) 2024-10-12T16:59:09.714Z Error: at DependencyManager.<anonymous> (c:\Users\Mariusz\.vscode\extensions\valentjn.vscode-ltex-13.1.0\dist\extension.js:13528:45) 2024-10-12T16:59:09.714Z Error: at Generator.next (<anonymous>) 2024-10-12T16:59:09.714Z Error: at fulfilled (c:\Users\Mariusz\.vscode\extensions\valentjn.vscode-ltex-13.1.0\dist\extension.js:13159:58) 2024-10-12T16:59:09.714Z Info: ltex-ls did not print expected version information to stdout. 2024-10-12T16:59:09.714Z Info: stdout of ltex-ls: 2024-10-12T16:59:09.714Z Info: 2024-10-12T16:59:09.714Z Info: stderr of ltex-ls: 2024-10-12T16:59:09.714Z Info:

epsonlq138 commented 1 month ago

This issue is because VS Code updated Node.js which includes this security fix: https://nodejs.org/en/blog/vulnerability/april-2024-security-releases-2 There is some documentation on starting shell processes here: https://nodejs.org/api/child_process.html#spawning-bat-and-cmd-files-on-windows And some discussion about it here: nodejs/node#52554

It can be fixed (not sure if this is a safe fix though). By replacing the executableOptions in extension.js (starting line 13618) with:

              const executableOptions = {
                encoding: 'utf-8',
                timeout: 15000,
                shell: true
              };

This is also a duplicate of issue #884

This not work for me with windows 10 and VScode 1.94.2, But I found another approach in https://github.com/valentjn/vscode-ltex/issues/884#issuecomment-2278544786 This work well.

Denno1996 commented 1 month ago

I´m facing the same problems here with Windows 11 and VCcode 1.94.2. I also use java 23 and LTex 13.1.0

Astlaan commented 3 days ago

Also faced the same problem. Is this repository still being maintained?

Wastus commented 3 days ago

No it's not, I changed to ltex-plus.vscode-ltex-plus, which is for now active and fixed this.