Package: Couldn't normalize path in `addResourcePath`


I packaged a shiny app and it's working fine locally. However, when I try to run it in other machines, I got this error

Warning: Error in value[[3L]]: Couldn't normalize path in addResourcePath, with arguments: prefix = 'htmlwidgets-1.4'; directoryPath = 'C:/Users/Gaston/Documents/R/win-library/3.6/htmlwidgets/www'

[No stack trace available]

I read this might be due to the packages version and/or Rstudio. Below is my sessionInfo()

R version 3.6.1 (2019-07-05)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.6

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] vitselR_0.1.0        tidyr_0.8.3          tibble_2.1.3         stringr_1.4.0       
 [5] shinydashboard_0.7.1 shiny_1.3.2          readxl_1.3.1         purrr_0.3.2         
 [9] plotly_4.9.0         openxlsx_4.1.0.1     magrittr_1.5         GGally_1.4.0        
[13] ggplot2_3.2.0        formattable_0.2.0.1  DT_0.7               dplyr_0.8.3         

loaded via a namespace (and not attached):
 [1] zip_2.0.3          Rcpp_1.0.1         later_0.8.0        cellranger_1.1.0   pillar_1.4.2      
 [6] compiler_3.6.1     RColorBrewer_1.1-2 plyr_1.8.4         tools_3.6.1        digest_0.6.20     
[11] viridisLite_0.3.0  jsonlite_1.6       evaluate_0.14      gtable_0.3.0       pkgconfig_2.0.2   
[16] rlang_0.4.0        rstudioapi_0.10    xfun_0.8           httr_1.4.0         withr_2.1.2       
[21] knitr_1.23         htmlwidgets_1.3    grid_3.6.1         tidyselect_0.2.5   data.table_1.12.2 
[26] reshape_0.8.8      glue_1.3.1         R6_2.4.0           rmarkdown_1.14     promises_1.0.1    
[31] scales_1.0.0       htmltools_0.3.6    rsconnect_0.8.13   assertthat_0.2.1   xtable_1.8-4      
[36] mime_0.7           colorspace_1.4-1   httpuv_1.5.1       stringi_1.4.3      lazyeval_0.2.2    
[41] munsell_0.5.0      crayon_1.3.4

This is related to shiny::addRessourcepath and I had an onLoad.R function where I mentioned addResourcePath

#' Adds the content of www to where/
#' @importFrom shiny addResourcePath
#' @noRd
.onLoad <- function(...) {
  shiny::addResourcePath("where", system.file('www', package = "MyPackage"))

In the ui.R file, I used for example img(src = "where/image.png"))

Grateful for any help.


Would you be able to provide the app code?

Are you sure you did not specify an absolute path somewhere in your code or set a working directory? This could lead to issues when deploying the app elsewhere...

Hope this helps,

Hi @pieterjanvc, thanks for your answer. I edited the question. Hope this provides some more details to the question.

Hello. I was able to overcome the issue by avoiding all packages that import htmlwidgets.
The same issue was reported here but not yet solved.