My basic app.R below fails to deploy on posit connect cloud. Does posit have to install something on the posit cloud infrastructure for terra and related packages to deploy? Or is there some other fix?
Thanks
2026-08-19T10:37:25+01:00 Error: package or namespace load failed for ‘terra’ in dyn.load(file, DLLpath = DLLpath, ...):
2026-08-19T10:37:25+01:00 unable to load shared object '/cloud/lib/x86_64-pc-linux-gnu-library/4.6/terra/libs/terra.so':
2026-08-19T10:37:25+01:00 libproj.so.25: cannot open shared object file: No such file or directory
2026-08-19T10:37:25+01:00 Execution halted
2026-08-19T10:37:25+01:00 Shiny application exiting ...
2026-08-19T10:37:25+01:00 Failed to connect: worker has exited
2026-08-19T10:37:25+01:00 Worker complete: exited unexpectedly with code 1
2026-08-19T10:37:25+01:00 Worker error: exit status 1
2026-08-19T10:37:25+01:00 Worker process stopped
2026-08-19T10:37:25+01:00 Failed to publish content: Your application failed to start. error_id=ec50012f-d556-4b69-a5db-67acf1197e91
library(shiny)
library(terra)
ui <- fluidPage(
titlePanel("Terra Test"),
mainPanel(
plotOutput("distPlot"),
)
)
server <- function(input, output) {
output$distPlot <- renderPlot({
# I suppose the following line may not work on posit connect cloud, but I can't get this far to see.
f <- system.file("ex/elev.tif", package="terra")
r <- rast(f)
plot(r)
})
}
shinyApp(ui = ui, server = server)
In case it helps, I think I found a fix on another thread related to shinyapps.io. This fix involves uing an older version of terra (i.e., version 1.8-93). For example, you can install it with the following:
remotes::install_version("terra", "1.8-93")
Alternatively, if you are using renv for package management, you could try this:
Posit support confirm terra/GDAL/libproj dependency issues on posit connect cloud. Avoid terra versions after v 1.9-27 and before v 1.9-38 if you need to deploy on posit connect cloud. (the latest dev version of terra does deploy, but takes time).
See