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

Failed to find typst-ws executable in VSCode remote #41

Closed
hnyls2002 opened this issue Jun 21, 2023 · 6 comments · Fixed by #83
Closed

Failed to find typst-ws executable in VSCode remote #41

hnyls2002 opened this issue Jun 21, 2023 · 6 comments · Fixed by #83
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@hnyls2002
Copy link

My environment is WSL ubuntu 20.04.

I just click the button at the up-right corner in my vscode, it's Typst Preview : preview current file, then the extension seems to not work well.

One error message says

Failed to start typst-ws(typst-ws) process: Error: spawn typst-ws ENOENT

Another message says

Failed to find typst-ws executable at /home/hnyls2002/.vscode-server/extensions/mgt19937.typst-preview-0.5.0-linux-x64/out/typst-ws,maybe we didn't ship it for your platform? Using typst-ws from PATH

It seems that the typst-ws is not found. I have no idea what it is.

Does the typst preview extension require installing typst throught rust tool chains ? I actually did it, and compiling a *.typ file into *.pdf using typst watch command works well on my laptop.

@Enter-tainer
Copy link
Owner

TLDR: You may download typst-ws-win32-x64.exe from release and put it in your $PATH. I guess it will fix this issue as a workaround. I will try to figure out how to better support vscode-remote-* enironment when I have time.

Failed to find typst-ws executable at /home/hnyls2002/.vscode-server/extensions/mgt19937.typst-preview-0.5.0-linux-x64/out/typst-ws

I didn't test it on vscode-remote-* environments. But I guess the problem here is that the extension(running in windows) tries to execute typst-ws in WSL. And that is not possible.

Does the typst preview extension require installing typst throught rust tool chains?

This extension works by compling your typst files to images (framebuffers, in effect) and send them throught websocket. These function are implemented in typst-ws. We already compile and bundle typst-ws in the vscode extension for all major platforms.

@Enter-tainer Enter-tainer added the bug Something isn't working label Jun 21, 2023
@Enter-tainer
Copy link
Owner

Enter-tainer commented Jun 21, 2023

You may download typst-ws-win32-x64.exe from release and put it in your $PATH

typo: download and rename it to typst-ws.exe, then put it in PATH.

But I'm afraid that this still won't work because it seems that the .exe part in the filename is missing. Maybe you can switch to native Windows/Linux before this issue is resolved.

@Myriad-Dreamin
Copy link
Collaborator

Myriad-Dreamin commented Jun 21, 2023

The vscode-clangd detaches the executable from its extension, and performs a early checking, which would be a possible better solution for a remote extension:

https://github.com/clangd/vscode-clangd/blob/d0653e60b0cce91b87a55e6321f9cb442cdf5a9d/src/install.ts#L98-L111

https://github.com/clangd/node-clangd/blob/76ab3335338d6c47ab15e1cfc8329b71baec999a/src/index.ts#L91-L106

The key is that the function checks to install a suitable executable for its inhabiting machine.

@ertomas
Copy link

ertomas commented Jun 22, 2023

You may download typst-ws-win32-x64.exe from release and put it in your $PATH

typo: download and rename it to typst-ws.exe, then put it in PATH.

But I'm afraid that this still won't work because it seems that the .exe part in the filename is missing. Maybe you can switch to native Windows/Linux before this issue is resolved.

I can confirm this does not work.

@Enter-tainer
Copy link
Owner

Enter-tainer commented Jul 14, 2023

After the v0.6.0 update, there are multiple websocket connections to be established between typst-ws(on remote machine), vscode extension host(remote machine?), and the vscode webview(your local machine). I'm afraid that the debugging would be very difficult if used with vscode-remote. These connections are used for the cross jump between the source code and the preview panel.

This extension provides full platform support and features low rendering latency. And I think running it on your local machine would give better UX.

Anyway, I will kept this issue open and I would take a look when I have time.

@Enter-tainer Enter-tainer changed the title Failed to find typst-ws executable Failed to find typst-ws executable in VSCode remote Jul 17, 2023
@Enter-tainer Enter-tainer added the help wanted Extra attention is needed label Jul 27, 2023
@Enter-tainer
Copy link
Owner

Enter-tainer commented Aug 15, 2023

We are starting to understand why this is happening thanks to the work of @Bubbleioa at #83. In short, there are two bugs.

  1. We build our Linux binary using ubuntu-latest (i.e. 22.04). Earlier ubuntu or linux version will fail and see error message like Failed to find typst-ws executable at... because of they have old glibc.
  2. We didn't forward the websocket used by sending data from the remote extension host to the webview on your local machine. This has been resolved in fix: vscode-remote support #83.

If you use the latest Ubuntu, remote preview will likely to work after #83 is merged. But I would suggest always using this extension on your local machine because previewing remotely introduces unnecessary network roundtrip.


Update: We are also downgrading the ci image to ubuntu-20.04 and hope it should work for ubuntu 2004 users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants