Shiny-NameSpace Error
Failed to Deploy Shiny Sever
After installing all required the packages, the shiny still reports “loading namespace” error, i.e.,
su: ignoring –preserve-environment, it’s mutually exclusive with –login
Error in loadNamespace(x) : there is no package called ‘jsonlite’
Calls: local … loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Execution halted
The critical bug occurs at the second line. Though I have checked the installation and loading of package jsonlite
, the problem keeps unsolved.
After searching the probable solution, one blog [1] reminds me that shiny work as the “root” user when offering service. It cannot access the “user-only” libraries on the server.
So I checked the existing library paths by .libPaths()
, and the found four different paths:
[1] “/home/arwen/R/x86_64-pc-linux-gnu-library/4.1”
[2] “/usr/local/lib/R/site-library”
[3] “/usr/lib/R/site-library”
[4] “/usr/lib/R/library”
Except the first one, the other three global libraries are all empty. Then I reinstalled the packages as the root user by sudo R
.
The shiny runs successfully!!
```