ficonsulting / RInno

How to install local shiny apps
https://ficonsulting.github.io/RInno/
Other
308 stars 67 forks source link

File not found in run.wsf #42

Open Aeilert opened 6 years ago

Aeilert commented 6 years ago

After creating an app with compile_iss I can't get the .bat-file to run. The problem seems to be with the run.wsf-script where a file is not found. I get a javascript runtime error on line 25, with code "800A0035" and message "file not found".

image

I got the same error message when I tried with the Cran-version of RInno (0.1.2), so this migth not be a specific problem for RInno 0.2.0. It could also be that I have done something else wrong.

The app on itselft runs fine (from RStudio).

Any idea what the issue migth be?

I'm running R-version 3.4.3 on a Windows 7 x64 computer. Script below.

EDIT: After checking the run.js-script I'm guessing the problem is related to the loading of the registry paths (line 25 tries to open/read utils/regpaths.json). There is no such file in my app's utils-folder. I found this previous issue, but not sure if it is related to mine. It could of course be a problem with finding the path to Chrome, Firefox etc., but I wonder why the file isn't created in the first place.

My operating system and browser is btw in norwegian. If that could be a problem?


require(devtools)
devtools::install_github("ficonsulting/RInno",  build_vignettes = TRUE, force = TRUE)

# Require Package
require(RInno)

# Use RInno to get Inno Setup
RInno::install_inno()

# Example app included with RInno package
setwd("C:/Users/username/Documents/Test")
example_app(wd = getwd())

# Build an installer
create_app(app_name = "Your appname", app_dir = "app")
compile_iss()```
Dripdrop12 commented 6 years ago

We have had some issues with French OS, so Norwegian may be the root cause of this. I don't know why it would prevent "regpaths.json" from being created though. This may take some time to investigate because I don't have a Norwegian OS to test it on...

Do you have any of these in your registry?

'Software\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe'
'Software\Microsoft\Windows\CurrentVersion\App Paths\IEXPLORE.EXE'
'Software\Microsoft\Windows\CurrentVersion\App Paths\firefox.exe'
'Software\R-Core\R\3.4.3'
Aeilert commented 6 years ago

Apologies for the late reply.

I'm not that well versed in registry-lookups, but I did find all of the mentioned paths under HKEY_LOCAL_MACHINE.

georgemirandajr commented 6 years ago

I am having this same issue today. What is strange is that this file was created for me before and worked fine, but I have not been able to get it to appear again. I have not been able to get RInno to work properly for my app, so I am repeatedly deleting everything, then running create_app again. I have been using R 3.3.0 and 64-bit Windows 7. I'm in Southern California, so this is not just a Norwegian thing.

Oh, and I'm using RInno 0.2.0.

Dripdrop12 commented 6 years ago

Yep, @bthomasbailey sent in a pull request yesterday that addresses this issue. Can you try devtools::install_github("ficonsulting/RInno") and let me know if that works for you? It looks like this bug can happen if you do not have the most recent version of R installed.

Dripdrop12 commented 6 years ago

2ed9b308dec9c9758df51ad4536872da27ec7b8d

ghost commented 6 years ago

@Dripdrop12, I did a fresh install with the lastest push and I am getting the same error. Iused the devtools install as well as having reinstall Inno and am still seeing the path issue. It does build fine with no issues in R and the Date Modified for the "run.wsf" matches the build time. rinno bug

Edit: I am running R-3.4.3

Dripdrop12 commented 6 years ago

When I got home tonight, I did a clean install of R 3.4.3 on a new machine and installed RInno from Github. I was not able to replicate the error... it worked for me.

I think @Aeilert is on to something with the missing utils/regpaths.json file. Maybe you can try to add some logging to the .iss script and compile it using the Inno Setup Compiler to trouble shoot the issue?

vonplato commented 6 years ago

I am having this same problem on a US English Windows 8.1 OS and R 3.4.3 with a dev tools install of RInno as listed on your GitHub page. Out of curiosity I will attempt to re-do this on my Win10 desktop at home to see if there is any difference.

To be more specific about my error, when I first install the app and click "launch" at the end of installation it seems to launch correctly but upon that first launch the app would continuously "look for a socket" and never find one... Once the app is closed and I attempt to re-open it, this particular bug occurs.

The app works fine if I compile it in R using shiny.

By the way, I love what you've done so far, I would never be this close to a deployed app without your help, thank you.

georgemirandajr commented 6 years ago

Today, after re-installing RInno via devtools::install_github("ficonsulting/RInno") and using R 3.4.3, there is now a regpaths.json file created when I run the setup executable file.

However, I then had an error come up saying it cannot find the file, run.wsf. It seems like it's looking in the wrong place because I installed my app on a network drive and UNC paths are not supported. Because of this, it defaults the working directory to the Windows directory (C:/Windows), which explains why it does not find the run.wsf there.

image

image

So I installed it again, but this time on my Desktop to avoid this issue and it worked!

Because of limitations by my work PC, I had to actually include my own library directory in my app and include a .libPaths("./library") in my server.R code. This is because the app is unable to download the required packages (I'm assuming a security issue) and I can assume this will be the case for other users in my organization.

maymenw commented 6 years ago

Hi, I am also getting this same error. I even tried to use my older compiled apps and after installing those they also have the same error

@georgemirandajr can you elaborate on this in more detail on how you did this "I had to actually include my own library directory in my app and include a .libPaths("./library") in my server.R code"

Are you creating a library folder with all the packages in them and then creating application files using create_app() function?

georgemirandajr commented 6 years ago

Hello @maymenw,

Yes, I created a new folder within my app's directory called "library". I know this folder is automatically created using create_app, but it is initially empty and my problem was that my user's would not be able to consistently download the packages because of our organization's internet issues. So I created that folder before I called create_app and filled it with the correct packages (including base R packages and dependencies, as well as jsonlite, shiny, and magrittr which are required for the app to start up). Do this before you use create_app because that function creates the Inno Setup Script, which specifies which files are to be compiled when building your executable. It will not include your packages in the .iss if they're not in the library folder already.

And I may not really need to explicitly call .libPaths("./library") in my server.R code because one of the RInno scripts handles that. However, I included it in my server code because I like to make sure of things. You can try it without this part and I'm sure you'll get the same result as if you had not called it explicitly.

I detailed my approach to making it work for me given my organization's constraints in a github repo: https://github.com/georgemirandajr/Desktop-Shiny-Apps-for-LAC

Hopefully, that gives you a better picture of what I did. I documented my approach because I likely will forget the details and I wanted to make it useful to others in my organization who use R and Shiny.

pratarora commented 6 years ago

Hey! I am also facing the same problem, where wscript is not able to locate wsf file.. the location seems fine but somehow it does not read the file.. I tried @georgemirandajr way but it didn't help, i still keep getting the same error. Moreover, after create app i don't get a library folder in the first place...

Upon further investigation I found that no "regpaths.json" is created, thus the error crops up..

I can send you my files on personal mail if required. I have tried this on a different machine as well, but it is still giving the same error. In fact, it doesn't even work with example provided in the package.

turqoisehat commented 6 years ago

Just gonna add a little fuel to the fire to say I have the same problem with file not found on win 10, R 3.5.1.

Gonna try the suggestions to install Dev version of RInno and try to build up that library folder before creating App. And put the directory on the desktop. I'll report back.

sollano commented 6 years ago

Same problem here, win 10, R 3.5.1, tried in a English and Portuguese based OS. I have no file named regpaths.json in the utils folder. And this is an app of mine that would previously build and run fine. There must be something wrong with the creation of this regpaths.json file. Can you point me to where this file is created?

I installed older versions of the package to see if that worked, since they used to run fine for me. It didn't. So that leads me to believe that maybe windows changed something with their updates, and the code you use to read registry paths no longer works.

Dripdrop12 commented 6 years ago

This is where it is created - https://github.com/ficonsulting/RInno/blob/46c9e31d62c0f11eb08d05569c001355fdf95d45/inst/installation/code.iss#L116-L156

sollano commented 6 years ago

Jon, I think I know what's going on. The regpaths.json file is created during the installation process. We were running create app and testing the app before compiling and installing, running the .bat file directly. Since the regpaths.json does not exist yet, the app fails.

Running the app before installing is a great way of debugging and testing different things, so maybe this could be something to add in a later version?

But anyway, I think this is it. When I install the app, the file is created and the app runs fine. This problem only occurs if I try to run it from the creation folder directly using the .bat file.

Can anyone else confirm this?

Dripdrop12 commented 6 years ago

@sollano - thanks for the feedback on this! I'm working on a debugging vignette and maybe we can work in a new workflow for pre-compile app tests. What do you think about replicating the creation of regpaths.json pre-compile so that the .bat will work?

sollano commented 6 years ago

No problem Jon, I'm glad to help. I think this is a great idea. I was actually doing this for debugging. It's great because you don't have compile and run the installer every time you wanna try something new, or even check to see if it's working. You can do it right from the folder, without compiling.

There's a caveat, though. What I was doing was copying the file to the folder for testing. It worked fine. However, compiling the app with the file already inside the folder, causes the installer to duplicate the lines of the regpaths.json. This probably happens because the installer tries to create the file, but, since it already exists, it simply adds the lines to the file. Right now, this is not an issue, but if we were to replicate the creation of regpaths.json pre-compile, we need to be aware of this. Maybe deleting the file when compiling, if it exists, or something like that.

I don't know if I was able to express this well enough, sorry if I didn't. But I think this would be a great feature! Good idea.

dimmin commented 3 years ago

I do have the same error (run.wsf not found) with DesktopDeplyR and land on this RInno issue. Maybe they are linked? https://github.com/wleepang/DesktopDeployR/issues/36

mu84 commented 3 years ago

Hi, for me the issue was I did not have nativefier-app in the app folder. What caused for me that in the file config.cfg in the utils folder there was empty value for natifier like : "nativefier": [ ]. After installation of notifier :https://www.npmjs.com/package/node-notifier, and later compilation I do have value like "nativefier": "nativefier-app/Compare_Tool-win32-x64/Compare_Tool.exe", and nativefier-ap in the app folder and working fine. Also I have tried other alternative and it was change the "user_browser": "electron", into the "user_browser": "chrome" , what worked for me as well. However also another issue poped up for me was wrong port so in the file launch_app.R I had to change the value port = 1984 into the free port in the relevant if clause I was using depending on chrome or electron. I hope this might help to someone as well.

PSGENGAJE11 commented 2 years ago

I have same issues with compile_iss().

  1. When I run compile_iss() from R, it asks me “Inno Setup not found, do you want to install it now?” If I choose ‘yes’, it downloads a ‘github’ file in my TEMP folder but can not install that since it’s an MS Dos application file and gives me an error “file is incompatible with your system”.
  2. So, I downloaded and installed Inno from installr::install.inno() which successfully installed Inno setup on my computer but compile_iss() doesn’t seem to find that.
  3. When I manually compile my .iss file from Inno compiler, it gets compiled but when it tries to install the setup for my app, it fails. I get an error with .wsf file. Sometimes I get “Expected “)” “, sometimes I get “Path not found”. I could not find any help on this issue.
cedricbouffard commented 2 years ago

Hi, I used this method regularly couple of years ago but it seems to not work anymore. I had the same issues, and I keep having trouble with this method (I find a solution for one step then another error occur), so I switch to Electron to build standalone app. I followed this guide, it's well explained and it worked. I wish we could still use RInno, but at least we have an alternative.