While publishing flexdashboard getting error of “Error in install.packages: unable to install packages”

How to publish Flexdashboard? This is my first time and getting this error.
While publishing shiny app getting error of "Error in install.packages: unable to install packages" in error log of app.

Code

---
title: "ForeOptics"
social: menu
runtime: shiny
output: 
  flexdashboard::flex_dashboard:
    orientation: rows
    vertical_layout: fill
---

Dashboard
===================================== 
```{r setup, include=FALSE}

library(devtools)
library(flexdashboard)
library(rmarkdown)
library(reshape2)
library(shiny)
library(xlsx)
library(dplyr)
library(knitr)
library(DT)
library(rpivotTable)
library(ggplot2)
library(plotly)
library(openintro)
library(highcharter)
library(ggvis)
library(rstudioapi)
library(lubridate)
library(hrbrthemes)
library(tidyr)
library(dbplyr)
library(odbc)
library(RODBC)
library(DBI)
library(htmlwidgets)
library(rsconnect)


dbconnection <- "Driver={SQL Server};Server=34.xxx.xxx.xxx,xxxx;UID=user;PWD=pwd;database=R_data;"
cn <-odbcDriverConnect(dbconnection)
`` `

After published application getting error in browser window.

An error has occurred. Check your logs or contact the app author for clarification.

error log message:

...    Warning in install.packages(new.pkg, dependencies = TRUE) :
...      'lib = "/opt/R/3.6.2/lib/R/library"' is not writable
...    Quitting from lines 21-132 (DashBord.rmd)
...    Warning: Error in install.packages: unable to install packages
...    152: stop
...    151: install.packages
...    150: ipak [<text>#11]
...    149: eval
...    148: eval
...    142: evaluate::evaluate
...    143: evaluate_call
...    139: block_exec
...    141: evaluate
...    138: call_block
...    137: process_group.block
...    134: process_file
...    133: knitr::knit
...    132: <Anonymous>
...    127: <reactive>
...    111: doc
...    110: shiny::renderUI
...     96: origRenderFunc
...    109: func
...     15: <Anonymous>
...      5: eval
...     95: output$__reactivedoc__
...     13: rmarkdown::run
...     12: fn
...      7: connect$retry
...      6: eval