zarathucorp / shiny-electron-template-m1

Template repository for build Standalone R Shiny application with Electron
MIT License
33 stars 37 forks source link

Error [ERR_REQUIRE_ESM]: require() of ES Module #2

Closed oyogo closed 1 year ago

oyogo commented 1 year ago

Hi Jinwan, Many thanks for the tutorial, I was wondering if you could be having an idea on what causes the above error on the subject line. I have used different versions of node to no avail. Any help please?

jhk0530 commented 1 year ago

Hi, if you share situation that occured error. it will be much helpful.

thanks

oyogo commented 1 year ago

Thank you for getting back, I have actually fixed it. I had to downgrade the axios and esm modules for it to work.

The issue I am facing now is running the shiny app with shiny modules. I am only able to run the app with the first page, the moment I add the modularized pages the application doesn't work after electron-forge start.

jhk0530 commented 1 year ago

Sounds good, can you tell me your axios and esm version? I think It's good to make note for that for other users.

Also, I don't know solution about modularized app's problem with electron (or shiny framework like golem.)

In simillar case, I just separated code as independent .R file, and load them using sourse function. and it worked.

oyogo commented 1 year ago

Screen Shot 2023-07-21 at 10 32 17.

This are the versions that worked finally

jhk0530 commented 1 year ago

Thanks ! I'll close this issue, but if you have anything to discuss you can open new issue.

YonghuiDong commented 1 year ago

Hi all,

I just add a small comment.

In case you are using golem frame work, you can use golem::add_rstudioconnect_file() to generate an app.R file, then the modularized app will work.

I guess it will also work for other modularized apps if you put the 'app.R' file under your shiny folder, and list the required libraries in the app.R file to install them.

Hope it helps.

Dong