5

I developed a Shiny app that runs fine locally, but I get

Error in library(shiny) : there is no package called 'shiny'

when I try to publish to shinyapps.io.

I have seen multiple responses about how to correct on Ubuntu, etc., but I am running R 3.2.2 and R Studio 0.99.486 on Windows 7 Enterprise.

How I can correct this problem on Windows?

MarcVL
  • 59
  • 1
  • 2

2 Answers2

5

I've found a solution in shinyapp's issue #73. They don't really explain why this happens, but they advise to use require() instead.

Both ui and server objects are functions and require() is prefered inside functions. Take a look at library()'s documentation:

library(package) and require(package) both load the namespace of the package with name package and attach it on the search list. require is designed for use inside other functions;

Tomás Barcellos
  • 814
  • 16
  • 26
  • 1
    Thanks Tomas. I will try this with require(), though it used to work without doing so in the past. To my knowledge, I did not update O/S, R/RStudio, etc. when I started encountering this issue. – MarcVL Sep 05 '17 at 21:51
  • 1
    This appears to have resolved the issue. Thanks Tomas. Not the best error message, but I am thankful that I am "back in business". I appreciate everyone's contributions! – MarcVL Sep 07 '17 at 16:07
2

A bit too late but maybe someone else will benefit from it later on.

Had same issue on Windows 10.

I just used manual installation:

  • Tools -> Install packages -> type your packages and hit install.

Then everything you need will be there for you.

AverageJoe9000
  • 348
  • 1
  • 14
  • 1
    Thanks Joe, The package is installed. As I mentioned above, this used to work as expected in the past, then "suddenly" I began encountering the error. Not sure exactly what might have changed that caused this new behavior. By chance, do you have other thoughts on this? Thanks! – MarcVL Sep 05 '17 at 21:52