...I deployed my very first shiny application and got this error:
An error has occurred
The application failed to start.
exit status 1
Can you help me solve this?
...I deployed my very first shiny application and got this error:
An error has occurred
The application failed to start.
exit status 1
Can you help me solve this?
Is it on Shinyapps.io or a different server?
If Shinyapps.io, you can get more detailed logs in the dashboard: you should have tabs like these
Go to the "Logs" tab, you should get more details about what's going wrong.
Thanks you for,
Yes it is on Shinyapps.io
in the log the error is here : Error in setwd("C:\Users\mandiaye\Desktop\Consultances\Appui_Profilage_ENABEL\Application") :
2024-06-04T15:32:41.166198+00:00 shinyapps[12124419]: cannot change working directory
Well, now you know
setwd()
only makes sense on your computer, when uploading to shinyapps.io you're uploading the app-containing folder, everything should be relative paths.
I understand, but I'm a beginner, so how do I create a relative path?
Remove this setwd()
. Let's imagine your application has files:
C:\Users\mandiaye\Desktop\Consultances\Appui_Profilage_ENABEL\Application\myapp.Rproj
C:\Users\mandiaye\Desktop\Consultances\Appui_Profilage_ENABEL\Application\app.R
C:\Users\mandiaye\Desktop\Consultances\Appui_Profilage_ENABEL\Application\data\mydata.csv
And inside app.R
you have this:
setwd("C:\Users\mandiaye\Desktop\Consultances\Appui_Profilage_ENABEL\Application")
mydata <- read_csv("data/mydata.csv")
Then you can just remove the setwd()
and everything should work by default: when starting a session, by default the current working directory is the one where the project is located. So if you type "data/"
you refer to the subdirectory data
inside your project directory.
One the other hand, if your application looks like:
C:\Users\mandiaye\Desktop\Consultances\Appui_Profilage_ENABEL\Application\myapp\myapp.Rproj
C:\Users\mandiaye\Desktop\Consultances\Appui_Profilage_ENABEL\Application\myapp\app.R
C:\Users\mandiaye\Desktop\Consultances\Appui_Profilage_ENABEL\Application\myapp\data\mydata.csv
And inside app.R
you have this:
setwd("C:\Users\mandiaye\Desktop\Consultances\Appui_Profilage_ENABEL\Application")
mydata <- read_csv("myapp/data/mydata.csv")
You would need to remove the setwd()
and also change the read_csv()
call to "data/mydata.csv"
, since the current working directory is already myapp
.
There are some more explanation here or there.
In any case, on your own computer, make sure you can get the application to run without any setwd()
and without any absolute path.
Thanks a lot i grasp
This topic was automatically closed 7 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.