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

Unable to reproduce on MacOS: Mounting filesystem images #508

Open
dusadrian opened this issue Jan 21, 2025 · 3 comments
Open

Unable to reproduce on MacOS: Mounting filesystem images #508

dusadrian opened this issue Jan 21, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@dusadrian
Copy link

Hi, I followed the instructions from the r-wasm 0.2.0 website.
I used a Docker image to build the Wasm R packages, closely following the instructions.

I managed to build several packages and used the add_pkg() command, and finally wanted to test (as per the above page) using a static server.

I used exactly the command suggested:

> httpuv::runStaticServer(
+   dir = ".",
+   port = 9090,
+   browse = FALSE,
+   headers = list("Access-Control-Allow-Origin" =  "*")
+ )
Serving: '.'
View at: http://127.0.0.1:9090
Press Esc or Ctrl + C to stop the server

and upon opening a webR session in the browser, I was unable to mount:

> webr::mount("/my-library", "http://127.0.0.1:9090/vfs/library.data")
Error in webr::mount("/my-library", "http://127.0.0.1:9090/vfs/library.data") : 
  Can't download Emscripten filesystem image metadata.

Then I started the static server in a different R session outside Docker, changing the "dir" argument to the output directory from Docker. Still no luck, neither mounting that image nor installing a package:

> webr::install("cli", repos = "http://127.0.0.1:9090/repo")
Warning: unable to access index for repository http://127.0.0.1:9090/repo/bin/emscripten/contrib/4.4:
  download from 'http://127.0.0.1:9090/repo/bin/emscripten/contrib/4.4/PACKAGES' failed
Warning message:
In webr::install("cli", repos = "http://127.0.0.1:9090/repo") :
  Requested package cli not found in webR binary repo.

This should work, but I just cannot get it done. I am on MacOS if that makes a difference, although I imagine it shouldn't.

@dusadrian dusadrian changed the title Unable to reproduce: Mounting filesystem images Unable to reproduce on MacOS: Mounting filesystem images Jan 22, 2025
@dusadrian
Copy link
Author

I just tried on a Windows virtual machine, and it works there.
So the problem must be related on MacOS, in which case I am unclear as to what to do next.

@georgestagg
Copy link
Member

Thanks for reporting back the working behaviour on Windows.

I think this is related to #475, where volume mounting is not working correctly under macOS.

There is a workaround in that thread that might be useful, (involving copying the output directories from the docker image to the environment outside Docker before starting the web server), but I have not tracked down the underlying issue yet.

@georgestagg georgestagg added the bug Something isn't working label Jan 22, 2025
@dusadrian
Copy link
Author

Thanks for the follow-up.
Happy to report this is a MacOS issue only for Safari. It works on Chrome, which I failed to test prior to submitting this issue.

It does not seem related to #475, as either way (directly saving into the /output or copying from Docker) work alright in Chrome. It is Safari that behaves differently, from some reason.

In fact, the whole exercise was for me to make sure I can mount an R library into a Node.js application. Now that I passed over this step, I have a different problem for which I will submit a new issue. Not sure if I should close the issue or not, so I leave it up to you. To me it is solved.

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

No branches or pull requests

2 participants