Unable to reproduce on MacOS: Mounting filesystem images
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.
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.
Thanks for reporting back the working behaviour on Windows.
I think this is related to https://github.com/r-wasm/webr/issues/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.
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.