Issue with publishing to RStudio Connect - Error in value[[3L]](cond) : there is no package called ‘...’

I'm trying to publish a shiny app from RStudio Pro to RStudio Connect. The R code uses a SOURCE function to refer to another file with R code in it. That other R file requires a specific package (timeDate) for some of the code, and I have a library(timeDate) command at the beginning it.

I can run the shiny app fine from RStudio Pro, but I get the following error when trying to publish it:

*Using Packrat dir /opt/rstudio-connect/mnt/app/packrat/lib/x86_64-redhat-linux-gnu/3.5.1*
*Error in value[[3L]](cond) : there is no package called ‘timeDate’*

Apparently it's trying to find the package in the wrong location? Is there a way I can specify the package location for this?


1 Like

I believe RStudio Connect should download & install packages from CRAN. Try updating your package and make sure the package version in your local RStudio matches that on CRAN.

My package version in RStudio Pro matches the latest package version in CRAN, so that doesn't appear to be the issue.

The RStudio IDE (all versions) uses the R package rsconnect to perform deployments to RStudio Connect. The rsconnect package (with packrat behind the scenes) identifies the package dependencies of your code. RStudio Connect reconstructs that environment (same R version, same package versions) on the server.

If timeDate is not found on the server, it is often because rsconnect and packrat did not identify that dependency.

Does your Shiny application include your other R file with code like the following?


Could you confirm that the otherfile.R is being included when you deploy your Shiny application? The easiest way to check is by looking for otherfile.R in the list of files as you go to deploy.


Could you also confirm that otherfile.R contains an explicit library statement like:


Less obvious dependencies will not be discovered.

If otherfile.R is included in the deployment and contains a simple library(timeDate) statement, we may have an issue identifying the dependencies for your content.

Could you open a support ticket for us to continue investigating? We'll want to gather details about your installation, deployment logs, and maybe the files contained in the deployment.

As a workaround, try adding an explicit library(timeDate) statement in your Shiny application code (app.R or server.R/ui.R).

1 Like

Thanks for the response aron,

I do have a source('otherfile.R') in my main app.r, and the otherfile.R is checked when I try to publish.

My otherfile.R has a library(timeDate) line at the very beginning too.

When I move the library(timeDate) from otherfile.R to app.r, I no longer get the there is no package called timeDate error. Instead I get a could not find function "holidayNYSE" error when trying to publish. (holidayNYSE is a function in timeDate, and I'm calling it from otherfile.R)

I will open a support ticket to pursue this.

1 Like

Thanks to Jay at RStudio support, I was able to get this issue resolved. The problem was that I was specifying my own .libpath. Once I commented that line out, I was able to successfully deploy. In Jay's words:

The issue is that the Shiny application tries to customize the .libPaths, which bypasses the environment that RStudio Connect is trying to establish

Thanks for the update @kbehm. We need to publish better guidance about things that might work locally but make it difficult to deploy content to RStudio Connect. Adjusting .libPaths is one of those things.

1 Like

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