electricShine icon indicating copy to clipboard operation
electricShine copied to clipboard

Error in eval(parse(text = text, keep.source = FALSE), envir)

Open yyangdii opened this issue 3 years ago • 10 comments

I'm a newbie trying to build a Shiny app using electricShine on Win10. The app is already structured as a golem package. While running the following electrify code:

`buildPath <- tempdir()

my_package <- "~/mygolem/"

electricShine::electrify(app_name = "my_app", semantic_version = "1.0.1", build_path = buildPath, mran_date = NULL, cran_like_url = "https://cran.r-project.org", function_name = "run_app", local_package_path = my_package, package_install_opts = list(type = "binary"), nodejs_path = file.path("C:/User/Documents/R/win-library/4.0/electricShine/nodejs/node-v12.16.2-win-x64"), run_build = TRUE)`

This error message occurs:

Finshed: Installing your Shiny package into electricShine framework Successfully created C:/User/AppData/Local/Temp/Rtmp4wy0fK/my_app/package.json Fehler in eval(parse(text = text, keep.source = FALSE), envir) : Objekt 'platform' nicht gefunden

The last line means "object 'platform' not fund".

Since I don't have any object named platform in my app code, I'm totally lost. Could you please help? Thanks a lot!

yyangdii avatar Feb 09 '21 09:02 yyangdii

It's a bug that needs to be fixed. Should work if you don't specify nodejs_path

For me: {glue} variables missing: https://github.com/chasemc/electricShine/blob/7a2a2fc6f13f91157ea7bee14279b98df393be7d/R/install_nodejs.R#L24

chasemc avatar Feb 10 '21 15:02 chasemc

I get the same error on Windows 10 R 4.0.3 and I haven't specified the nodejs_path.

`buildPath <- tempdir()

electricShine::electrify(app_name = "My_App", short_description = "My demo application", semantic_version = "1.0.0", build_path = buildPath, mran_date = NULL, cran_like_url = "https://cran.r-project.org", function_name = "run_app", git_host = "github", git_repo = "chasemc/demoApp@8426481", local_package_path = NULL, package_install_opts = list(type = "binary"), run_build = TRUE)`

drchriscole avatar Feb 24 '21 18:02 drchriscole

Hi. I got the same error. Windows 10 R 4.0.4

hotakamaeda avatar Feb 25 '21 23:02 hotakamaeda

Confirmed, will work on fix

chasemc avatar Feb 26 '21 21:02 chasemc

Hello @chasemc - @hotakamaeda has a solution for this. If you manually set platform <- "win" and arch <- "x64" before running electrify then there's no platform error. But also see my comment on the webpackmerge-fix PR as that doesn't seem to have solved the merge is not a function issue - yet manually installing the corresponding webpackmerge-fix commit does, which is really weird. So I think the above people may run into that after sorting out the platform issue. HTH.

py9mrg avatar Mar 01 '21 09:03 py9mrg

Hello @chasemc - @hotakamaeda has a solution for this. If you manually set platform <- "win" and arch <- "x64" before running electrify then there's no platform error. But also see my comment on the webpackmerge-fix PR as that doesn't seem to have solved the merge is not a function issue - yet manually installing the corresponding webpackmerge-fix commit does, which is really weird. So I think the above people may run into that after sorting out the platform issue. HTH.

Thanks for this. After manually installing webpackmerge-fix the demo app at "chasemc/demoApp@8426481" installs and runs fine. However, downloading the exact same repo and trying to install locally results in an app that loads infinitely with the error message "Uncaught Exception: Error: read ECONNRESET at TCP.onStreamRead (internal/stream_base_common.js:200.27)" in a pop-up box. In addition, I can't seem to get any golem Shiny apps to work at all.

Any known fix for the issue? Is this a known issue with the local installer and not the Github installer? Cheers

mcmcapewell avatar Mar 29 '21 10:03 mcmcapewell

@mcmcapewell not sure about the error message sorry, looks like something to do with nodejs but I know next to nothing about that. Edit - I've never had an issue with installing locally FWIW. If you explain exactly what you've tried I can copy it my end if I get the time.

If I remember right, golem apps won't work out of the box any more. Long story short, I think the problem is that golem have changed how they initiate their apps since the eS package was written. I don't fully understand what but when I was starting out with eS I whittled down the potential causes to changes in what the run_app function does in golem now. If you want to use golem you'll need to change that function to the more simple style you see in the eS demoApp (or vice versa). Otherwise forget about golem for now. I think @chasemc plans to update eS to be compatible with golem again, but it might be a big job so finding the time is not easy I imagine.

py9mrg avatar Mar 29 '21 10:03 py9mrg

@py9mrg Thanks for your info - didn't realise that about golem. The ECONNRESET issue with hanging loading screen was because I was using an old version of run_app in the demoApp, and selected the wrong version of the commit I was trying to get a hold of (@8426481, located at @84264811068ca354ba66acbe2216f9e5586bfd45 which I struggled to find).

I've basically been replicating what you've done in #317 to start with the working demoApp and build up from there. I realise you've some valuable advice about Depends/Imports and the NAMESPACE so I'll dilligently follow that in your post. Cheers.

mcmcapewell avatar Mar 30 '21 12:03 mcmcapewell

Update: https://github.com/chasemc/electricShine/projects

chasemc avatar Apr 04 '21 13:04 chasemc

I am also getting this error when trying to create the demo app on windows10 using the verbatim code from the example library(electricShine) buildPath <- tempdir()

electricShine::electrify(app_name = "My_App", short_description = "My demo application", semantic_version = "1.0.0", build_path = buildPath, function_name = "run_app", git_host = "github", git_repo = "chasemc/demoApp@8426481", package_install_opts = list(type = "binary", dependencies = c("Depends", "Imports") ), cran_like_url = "https://cran.r-project.org" )

nevilamos avatar Aug 24 '22 06:08 nevilamos