:3838/sample-apps/hello page is not working fine. It is giving error "The application exited during initialization."

Hello @aklongmuir

My :3838/sample-apps/hello page is not working fine. It is giving error "The application exited during initialization."

Could you please let me know the possible root cause for this error and respective solution ? Please let me know if you need any other information.

Thanks in advance.

I am facing the same issue on RedHat 6 as the topic thread above,
I can open the Shiny server webpage but not able to execute sample "hello" program. Did you get any solution for this if yes please share ?

Thanks in advance.

Do you have set proper permissions for shiny user?

sudo groupadd shiny-apps
sudo usermod -aG shiny-apps your_user # Put your regular user here
sudo usermod -aG shiny-apps shiny
cd /srv/shiny-server
sudo chown -R your_user:shiny-apps . # Put your regular user here
sudo chmod -R g+w .
sudo chmod -R g+s .

And, have you checked that the symlinks to the sample apps are working? you can repair the symlinks with something like this

sudo ln -s /opt/shiny-server/samples/welcome.html /srv/shiny-server/index.html
sudo ln -s /opt/shiny-server/samples/sample-apps /srv/shiny-server/sample-apps
1 Like

Hi @andresrcs,

Thank you for your reply... I have kept everything in my local directory and executed your mentioned commands. Still I am facing same issue. Could you please let me know how should be my config file ?

What do you mean by your local directory? Shiny apps should be hosted on the /srv/shiny-server folder

By my local directory means any other directory on which my user id "kapil" has accesses. I have executed 3 times with respective users as "root", "shiny", "kapil" with respective changes in conf file everytime it got failed. Can you please let me know what should be my user (I would like to keep it as "kapil") and permission level on directories ?

I'm still confused about what you are saying, this thread is about running apps on shiny-server, so you can access them from a browser with an address like http://your_server_ip:3838/your_app_folder. That address points to the folder specified on the site_dir variable (/srv/shiny-server by default), and runs the app on a new R session for the run_as user (shiny by default).

A default configuration file looks like this

# Instruct Shiny Server to run applications as the user "shiny"
run_as shiny;
# Define a server that listens on port 3838
server {
  listen 3838;

  # Define a location at the base URL
  location / {

    # Host the directory of Shiny Apps stored in this directory
    site_dir /srv/shiny-server;

    # Log all Shiny output to files in this directory
    log_dir /var/log/shiny-server;

    # When a user visits the base URL rather than a particular application,
    # an index of the applications available in this directory will be shown.
    directory_index on;

What modifications have you done? and what exactly are you trying to do?

Hi @andresrcs,

Apologies for confusion.
In first run I haven't made any changes. I have kept the config file as default.
I can open the Shiny welcome pages but when I click on /sample-apps/hello/. It is giving me below error.

An error has occurred

The application failed to start.

The application exited during initialization.

When you try to access this in your browser http://your_server_ip:3838/sample-apps/hello/ What your logs say?
You can find the logs for each one of your apps in this folder /var/log/shiny-server

1 Like

Hi @andresrcs,

Unfortunately log file is being created of zero byte.

Also I am not able to run shiny-server as background process.

Below is the error.

$ systemctl start shiny-server
System has not been booted with systemd as init system (PID 1). Can't operate.

That error is system specific, I have never worked with RedHat but if systemctl doesn't work for you, try with this other command for checking the status of your shiny-server

/sbin/service shiny-server status
1 Like

Hi @andresrcs,

Unfortunately this command is also not working. Please note I am using UBANTU.

$ sudo /sbin/service shiny-server status
sudo: /sbin/service: command not found

Hi @andresrcs,

Managed to get logs. Below is culprit..

Error in loadNamespace(name) : there is no package called ‘digest’

I have installed package "digest" but still facing the same error.

You need to install packages system wide in order for shiny been able to use them, try with this command from your system terminal

sudo su - -c "R -e \"install.packages('diges', repos='http://cran.rstudio.com/')\""

Hi @andresrcs,

Finally it worked... Thank you very much for your valuable time and support.

Appreciate your help... :blush:

1 Like

The simplest way is to change user in shiny config file
from run_as shiny;
to whatever user you use when you test your project in Rstudio. In this case you don't need to install all needed packaged again every time.
Also, this helps to track detailed error messages - they go directly to browser and it says what packages you miss:
options(shiny.sanitize.errors = FALSE)

1 Like

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.