juba / robservable

Observable notebooks as R htmlwidgets
https://juba.github.io/robservable/
163 stars 11 forks source link

RuntimeError: invalid module #50

Closed vondieps closed 1 year ago

vondieps commented 1 year ago

Appears that in instances where plot from "@observablehq/plot" is required, robservable fails. Have made a few attempts to troubleshoot but knowledge of js modules very limited.

For example, when running the below taken from https://juba.github.io/robservable/articles/introduction.html

robservable( "@juba/robservable-bar-chart", include = "chart" )

get RuntimeError: invalid module in R Viewer pane

Same error is reproduced for other observable notebooks that also require the plot module from @observable/plot (for example 'summary data' notebook by Mike Freeman.

Fwiw- found the following article, but not sure how to apply when using robservable: https://observablehq.com/@observablehq/how-to-require-stubborn-modules

Thanks for all your brilliant work on this!

juba commented 1 year ago

Are you using RStudio ? If you click on "show in new window" and the plot opens in a browser window, does it work ?

vondieps commented 1 year ago

Thanks for the speedy reply! Yes, using RStudio...a little more digging led to discovery from earlier thread here: https://github.com/juba/robservable/issues/46. As mentioned midway down - and as of writing in June '22 - RStudio's native viewer was 11 versions behind the latest Chrome release. Since the older browser version used by RStudio doesn't work with '?.' notation used in observable's plot library, RuntimeError is thrown. Problem solved by embedding robservable logic in shiny app then opening in an up-to-date browser instead. All now working beautifully.