title: Shiny server - how to install packages in localhost?
body: <p>I have installed Shiny Server in my local machine following the steps <a href="https://www.rstudio.com/products/shiny/download-server/" rel="nofollow">here</a>.</p>
  
  <p>I also manage to get the default sample app running at <a href="http://127.0.0.1:3838/sample-apps/hello/" rel="nofollow">http://127.0.0.1:3838/sample-apps/hello/</a></p>
  
  <p>But when I want to run the app that I have been working on RStduio, I get this error, </p>
  
  <blockquote>
    <p>An error has occurred</p>
    
    <p>The application failed to start.</p>
    
    <p>The application exited during initialization.</p>
    
    <p>Error in library(plyr) : there is no package called ‘plyr’ Calls:
    runApp ... sourceUTF8 -> eval -> eval -> ..stacktraceon.. -> library
    Execution halted</p>
  </blockquote>
  
  <p>I have installed all the packages via RStudio and they are in this directory,</p>
  
  <pre><code>/home/tealou/R/x86_64-pc-linux-gnu-library/3.2/
  </code></pre>
  
  <p>I can see plyr is already installed.</p>
  
  <pre><code>.../3.2/
        plyr/
  </code></pre>
  
  <p>But why the Shiny Server does not pick up the packages in the directory above?</p>
  
  <p>Where should I install the packages for the server then? and how?</p>
  
  <p>Any ideas?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <pre><code># 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;
      PATH=/home/tealou/R/x86_64-pc-linux-gnu-library/3.2/
    }
  }
  </code></pre>