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
785 stars 26 forks source link

Did not work on Windows, JAVA problem #886

Open milen-prg opened 1 month ago

milen-prg commented 1 month 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 1 month 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 1 month 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 1 month 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 weeks 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