R Shiny dashboard deployment failed with error as publishing to Posit Connect

Hi all!

I have created a R Shiny dashboard and would like to deploy it into Posit Connect due to company request. I've successfully publish it to shinyapps.io and it works well. But when I tried to change the destination to Posit Connect, I received error message said that Deployment failed with error: exit status 1. According to the log, the error is related to package 'terra' installation.

Here are the logs I received:

Installing terra (1.7-71) ...
curl: HTTP 200 https://cran.rstudio.com/src/contrib/terra_1.7-71.tar.gz
[1] "Command failed (1)\n\nFailed to run system command:\n\n\t'/opt/R/4.3.0/lib/R/bin/R' --vanilla CMD INSTALL --preclean '/opt/rstudio-connect/mnt/tmp/RtmpXCiJiD/packrat-install-5f3739f4fdc8/terra' --library='/opt/rstudio-connect/mnt/app/packrat/lib/x86_64-pc-linux-gnu/4.3.0' --install-tests --no-docs --no-multiarch --no-demo \n\nThe command failed with output:\n* installing source package ‘terra’ ...\n** package ‘terra’ successfully unpacked and MD5 sums checked\n** using staged installation\nconfigure: CC: gcc -std=gnu11\nconfigure: CXX: g++ -std=gnu++11\nchecking for gdal-config... /usr/local/bin/gdal-config\nchecking gdal-config usability... yes\nconfigure: GDAL: 2.4.2\nchecking GDAL version >= 2.0.1... yes\nchecking for gcc... gcc -std=gnu11\nchecking whether the C compiler works... yes\nchecking for C compiler default output file name... a.out\nchecking for suffix of executables... \nchecking whether we are cross compiling... no\nchecking for suffix of object fil
es... o\nchecking whether the compiler supports GNU C... yes\nchecking whether gcc -std=gnu11 accepts -g... yes\nchecking for gcc -std=gnu11 option to enable C11 features... none needed\nchecking for stdio.h... yes\nchecking for stdlib.h... yes\nchecking for string.h... yes\nchecking for inttypes.h... yes\nchecking for stdint.h... yes\nchecking for strings.h... yes\nchecking for sys/stat.h... yes\nchecking for sys/types.h... yes\nchecking for unistd.h... yes\nchecking for gdal.h... yes\nchecking GDAL: linking with --libs only... yes\nchecking GDAL: /usr/local/share/gdal/pcs.csv readable... yes\nchecking GDAL: checking whether PROJ is available for linking:... yes\nchecking GDAL: checking whether PROJ is available for running:... yes\nconfigure: GDAL: 2.4.2\nchecking for proj.h... no\nchecking for proj_api.h... yes\nchecking for pj_init_plus in -lproj... yes\nchecking PROJ: epsg found and readable... no\nError: proj/epsg not found\nEither install missing proj support files, for example\nthe proj-nad and proj-e
psg RPMs on systems using RPMs,\nor if installed but not autodetected, set PROJ_LIB to the\ncorrect path, and if need be use the --with-proj-share=\nconfigure argument.\nERROR: configuration failed for package ‘terra’\n* removing ‘/opt/rstudio-connect/mnt/app/packrat/lib/x86_64-pc-linux-gnu/4.3.0/terra’"
Error: Command failed (1)

Failed to run system command:

'/opt/R/4.3.0/lib/R/bin/R' --vanilla CMD INSTALL --preclean '/opt/rstudio-connect/mnt/tmp/RtmpXCiJiD/packrat-install-5f3739f4fdc8/terra' --library='/opt/rstudio-connect/mnt/app/packrat/lib/x86_64-pc-linux-gnu/4.3.0' --install-tests --no-docs --no-multiarch --no-demo

The command failed with output:

  • installing source package ‘terra’ ...
    ** package ‘terra’ successfully unpacked and MD5 sums checked
    ** using staged installation
    configure: CC: gcc -std=gnu11
    configure: CXX: g++ -std=gnu++11
    checking for gdal-config... /usr/local/bin/gdal-config
    checking gdal-config usability... yes
    configure: GDAL: 2.4.2
    checking GDAL version >= 2.0.1... yes
    checking for gcc... gcc -std=gnu11
    checking whether the C compiler works... yes
    checking for C compiler default output file name... a.out
    checking for suffix of executables...
    checking whether we are cross compiling... no
    checking for suffix of object files... o
    checking whether the compiler supports GNU C... yes
    checking whether gcc -std=gnu11 accepts -g... yes
    checking for gcc -std=gnu11 option to enable C11 features... none needed
    checking for stdio.h... yes
    checking for stdlib.h... yes
    checking for string.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for strings.h... yes
    checking for sys/stat.h... yes
    checking for sys/types.h... yes
    checking for unistd.h... yes
    checking for gdal.h... yes
    checking GDAL: linking with --libs only... yes
    checking GDAL: /usr/local/share/gdal/pcs.csv readable... yes
    checking GDAL: checking whether PROJ is available for linking:... yes
    checking GDAL: checking whether PROJ is available for running:... yes
    configure: GDAL: 2.4.2
    checking for proj.h... no
    checking for proj_api.h... yes
    checking for pj_init_plus in -lproj... yes
    checking PROJ: epsg found and readable... no
    Error: proj/epsg not found
    Either install missing proj support files, for example
    the proj-nad and proj-epsg RPMs on systems using RPMs,
    or if installed but not autodetected, set PROJ_LIB to the
    correct path, and if need be use the --with-proj-share=
    configure argument.
    ERROR: configuration failed for package ‘terra’
  • removing ‘/opt/rstudio-connect/mnt/app/packrat/lib/x86_64-pc-linux-gnu/4.3.0/terra’

Unable to fully restore the R packages associated with this deployment.
Please review the preceding messages to determine which package
encountered installation difficulty and the cause of the failure.
Warning message:
In packrat::restore(overwrite.dirty = TRUE, prompt = FALSE, restart = FALSE) :
The most recent snapshot was generated using R version 4.3.2
Build error: exit status 1
── Deployment complete ─────────────────────────────────────────────────────────
:heavy_multiplication_x: Deployment failed with error: exit status 1

Any suggestion would be appreciated!