Reputation: 109
I have been trying to deploy a shiny app using rsconnect: deployapp(appname = "myapp")
. I get the following message at the command prompt:
Application successfully deployed to https://sitename.shinyapps.io/MyApp/
However, when I launch the app, I get the error message:
ERROR: cannot change working directory
Based on resolution to similar problem on both Stackoverflow and googleforum, I tried using both absolute and relative paths in setwd()
. Following are the error messages with both absolute and relative paths to setwd()
:
Error in setwd("~/Data/Projects/MyApp"): cannot change working directory
Error in setwd("C:/Users/Documents/Data/Projects/MyApp"): cannot change working directory
Any suggestions to resolve the issue would be greatly appreciated. thanks in advance!
Upvotes: 9
Views: 10864
Reputation: 21
Error in setwd("c:/nonexistent_directory_path") : cannot change working directory
This error message will be generated when a directory does not exist. Verify that directory does in fact exist (ie: check spelling, typos).
Upvotes: 1
Reputation: 503
shinyapps.io is a virtualized container service running shiny apps.
C:/
do not make sense in the linux world.~/Data
might not exist. Work with relative paths ~/
Also put a checkguard with dir.exists()
and dir.create
dirname <- '~/Data/Projects/MyApp'
if (!dir.exists(dirname))dir.create(dirname,recursive=TRUE)
FYI I don't really think your should be doing any setwd()
for shinyapps. If the data file is is in ~/Data/Projects/Myapp/somedata.csv
you can do a direct read in the app as read.csv('somedata.csv')
.
The server directory structure is in the form of /srv/shiny-server/MyShinyApp
when you upload
Upvotes: 8