• R语言
  • 【已解决】shiny 部署失败,失败

我去掉了代码中所有的中文字符,甚至注释中的也一并去掉了。部署前也运行了options(encoding = "UTF-8"),但是运行后总是出现:

> warnings()
警告信息:
1: In readLines(certificateFile, warn = FALSE) :
  invalid input found on input connection 'E:/R library/rsconnect/cert/cacert.pem'
2: In readLines(certificateFile, warn = FALSE) :
  invalid input found on input connection 'E:/R library/rsconnect/cert/cacert.pem'
Warning message:
In readLines(certificateFile, warn = FALSE) :
  invalid input found on input connection 'E:/R library/rsconnect/cert/cacert.pem'

而在我运行library(rsconnect)后没有警告出现了(这行代码在server.R中也有),deploy过程中也没有报错,可是最后打开的网站就顶部写着:

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

除此之外没有别的报错了。请问有一些解决方案或者是提示吗?

> sessioninfo::session_info()
- Session info ------------------------------------------------------------------------------------
 setting  value                         
 version  R version 3.6.0 (2019-04-26)  
 os       Windows 10 x64                
 system   x86_64, mingw32               
 ui       RStudio                       
 language (EN)                          
 collate  Chinese (Simplified)_China.936
 ctype    Chinese (Simplified)_China.936
 tz       Asia/Taipei                   
 date     2019-05-23                    

- Packages ----------------------------------------------------------------------------------------
 package      * version    date       lib source                              
 ash            1.0-15     2015-09-01 [1] CRAN (R 3.6.0)                      
 askpass        1.1        2019-01-13 [1] CRAN (R 3.6.0)                      
 assertthat     0.2.1      2019-03-21 [1] CRAN (R 3.5.3)                      
 backports      1.1.4      2019-04-10 [1] CRAN (R 3.6.0)                      
 broom          0.5.2      2019-04-07 [1] CRAN (R 3.6.0)                      
 Cairo          1.5-10     2019-03-28 [1] CRAN (R 3.5.3)                      
 callr          3.2.0      2019-03-15 [1] CRAN (R 3.6.0)                      
 cellranger     1.1.0      2016-07-27 [1] CRAN (R 3.6.0)                      
 cli            1.1.0      2019-03-19 [1] CRAN (R 3.5.3)                      
 clipr          0.6.0      2019-04-15 [1] CRAN (R 3.6.0)                      
 codetools      0.2-16     2018-12-24 [2] CRAN (R 3.6.0)                      
 colorspace     1.4-1      2019-03-18 [1] CRAN (R 3.5.3)                      
 cowplot      * 0.9.4      2019-01-08 [1] CRAN (R 3.6.0)                      
 crayon         1.3.4      2017-09-16 [1] CRAN (R 3.6.0)                      
 crosstalk      1.0.0      2016-12-21 [1] CRAN (R 3.6.0)                      
 data.table     1.12.2     2019-04-07 [1] CRAN (R 3.6.0)                      
 digest         0.6.18     2018-10-10 [1] CRAN (R 3.6.0)                      
 dplyr        * 0.8.0.1    2019-02-15 [1] CRAN (R 3.6.0)                      
 DT             0.5        2018-11-05 [1] CRAN (R 3.6.0)                      
 dygraphs     * 1.1.1.6    2018-07-11 [1] CRAN (R 3.6.0)                      
 egg          * 0.4.2      2018-11-03 [1] CRAN (R 3.6.0)                      
 evaluate       0.13       2019-02-12 [1] CRAN (R 3.6.0)                      
 extrafont      0.17       2014-12-08 [1] CRAN (R 3.6.0)                      
 extrafontdb    1.0        2012-06-11 [1] CRAN (R 3.6.0)                      
 fansi          0.4.0      2018-10-05 [1] CRAN (R 3.6.0)                      
 forcats      * 0.4.0      2019-02-17 [1] CRAN (R 3.6.0)                      
 foreach      * 1.4.4      2017-12-12 [1] CRAN (R 3.6.0)                      
 fs             1.3.1      2019-05-06 [1] CRAN (R 3.6.0)                      
 GA           * 3.2        2019-01-10 [1] CRAN (R 3.6.0)                      
 generics       0.0.2      2018-11-29 [1] CRAN (R 3.6.0)                      
 ggalt        * 0.4.0      2017-02-15 [1] CRAN (R 3.6.0)                      
 ggplot2      * 3.1.1      2019-04-07 [1] CRAN (R 3.5.3)                      
 ggpubr       * 0.2        2018-11-15 [1] CRAN (R 3.6.0)                      
 glue           1.3.1      2019-03-12 [1] CRAN (R 3.6.0)                      
 gridExtra    * 2.3        2017-09-09 [1] CRAN (R 3.6.0)                      
 gtable         0.3.0      2019-03-25 [1] CRAN (R 3.5.3)                      
 haven          2.1.0      2019-02-19 [1] CRAN (R 3.6.0)                      
 hms            0.4.2      2018-03-10 [1] CRAN (R 3.6.0)                      
 htmltools      0.3.6      2017-04-28 [1] CRAN (R 3.6.0)                      
 htmlwidgets    1.3        2018-09-30 [1] CRAN (R 3.6.0)                      
 httpuv         1.5.1      2019-04-05 [1] CRAN (R 3.5.3)                      
 httr           1.4.0      2018-12-11 [1] CRAN (R 3.6.0)                      
 iterators    * 1.0.10     2018-07-13 [1] CRAN (R 3.6.0)                      
 janitor      * 1.2.0.9000 2019-04-23 [1] Github (sfirke/janitor@b0455e1)     
 jsonlite       1.6        2018-12-07 [1] CRAN (R 3.6.0)                      
 KernSmooth     2.23-15    2015-06-29 [2] CRAN (R 3.6.0)                      
 knitr          1.22       2019-03-08 [1] CRAN (R 3.6.0)                      
 labeling       0.3        2014-08-23 [1] CRAN (R 3.6.0)                      
 later          0.8.0      2019-02-11 [1] CRAN (R 3.6.0)                      
 lattice        0.20-38    2018-11-04 [2] CRAN (R 3.6.0)                      
 lazyeval       0.2.2      2019-03-15 [1] CRAN (R 3.5.3)                      
 lubridate    * 1.7.4      2018-04-11 [1] CRAN (R 3.6.0)                      
 magrittr     * 1.5        2014-11-22 [1] CRAN (R 3.6.0)                      
 maps           3.3.0      2018-04-03 [1] CRAN (R 3.6.0)                      
 MASS           7.3-51.4   2019-03-31 [2] CRAN (R 3.6.0)                      
 mime           0.6        2018-10-05 [1] CRAN (R 3.6.0)                      
 modelr         0.1.4      2019-02-18 [1] CRAN (R 3.6.0)                      
 multicolor   * 0.1.3      2019-04-13 [1] CRAN (R 3.6.0)                      
 munsell        0.5.0      2018-06-12 [1] CRAN (R 3.6.0)                      
 nlme           3.1-139    2019-04-09 [2] CRAN (R 3.6.0)                      
 openssl        1.3        2019-03-22 [1] CRAN (R 3.6.0)                      
 ourbir       * 0.1.0      2019-03-20 [1] Github (hoasxyz/ourbir@58587b4)     
 packrat        0.5.0      2018-11-14 [1] CRAN (R 3.6.0)                      
 pacman       * 0.5.1      2019-03-11 [1] CRAN (R 3.6.0)                      
 patchwork    * 0.0.1      2019-05-17 [1] Github (thomasp85/patchwork@fd7958b)
 pillar         1.4.0      2019-05-11 [1] CRAN (R 3.6.0)                      
 pkgconfig      2.0.2      2018-08-16 [1] CRAN (R 3.6.0)                      
 plotly       * 4.9.0      2019-04-30 [1] Github (ropensci/plotly@9b5c4f6)    
 plyr           1.8.4      2016-06-08 [1] CRAN (R 3.6.0)                      
 praise       * 1.0.0      2015-08-11 [1] CRAN (R 3.6.0)                      
 processx       3.3.0      2019-03-10 [1] CRAN (R 3.6.0)                      
 proj4          1.0-8      2012-08-05 [1] CRAN (R 3.6.0)                      
 promises       1.0.1      2018-04-13 [1] CRAN (R 3.6.0)                      
 ps             1.3.0      2018-12-21 [1] CRAN (R 3.6.0)                      
 pso            1.0.3      2012-09-02 [1] CRAN (R 3.6.0)                      
 purrr        * 0.3.2      2019-03-15 [1] CRAN (R 3.6.0)                      
 R6             2.4.0      2019-02-14 [1] CRAN (R 3.6.0)                      
 RColorBrewer   1.1-2      2014-12-07 [1] CRAN (R 3.6.0)                      
 Rcpp           1.0.1      2019-03-17 [1] CRAN (R 3.6.0)                      
 readr        * 1.3.1      2018-12-21 [1] CRAN (R 3.6.0)                      
 readxl       * 1.3.1      2019-03-13 [1] CRAN (R 3.6.0)                      
 reprex         0.2.1      2018-09-16 [1] CRAN (R 3.6.0)                      
 reshape2     * 1.4.3      2017-12-11 [1] CRAN (R 3.6.0)                      
 rlang          0.3.4      2019-04-07 [1] CRAN (R 3.5.3)                      
 rmarkdown      1.12       2019-03-14 [1] CRAN (R 3.6.0)                      
 rsconnect      0.8.13     2019-01-10 [1] CRAN (R 3.6.0)                      
 rstudioapi     0.10       2019-03-19 [1] CRAN (R 3.5.3)                      
 Rttf2pt1       1.3.7      2018-06-29 [1] CRAN (R 3.6.0)                      
 rvest          0.3.3      2019-04-11 [1] CRAN (R 3.6.0)                      
 scales         1.0.0      2018-08-09 [1] CRAN (R 3.6.0)                      
 sessioninfo    1.1.1      2018-11-05 [1] CRAN (R 3.6.0)                      
 shiny        * 1.3.2      2019-04-22 [1] CRAN (R 3.6.0)                      
 shinythemes  * 1.1.2      2018-11-06 [1] CRAN (R 3.6.0)                      
 stringi        1.4.3      2019-03-12 [1] CRAN (R 3.6.0)                      
 stringr      * 1.4.0      2019-02-10 [1] CRAN (R 3.6.0)                      
 tibble       * 2.1.1      2019-03-16 [1] CRAN (R 3.6.0)                      
 tidyr        * 0.8.3      2019-03-01 [1] CRAN (R 3.6.0)                      
 tidyselect     0.2.5      2018-10-11 [1] CRAN (R 3.6.0)                      
 tidyverse    * 1.2.1      2017-11-14 [1] CRAN (R 3.6.0)                      
 tsdecomp     * 0.2        2017-01-04 [1] CRAN (R 3.6.0)                      
 utf8           1.1.4      2018-05-24 [1] CRAN (R 3.6.0)                      
 vctrs          0.1.0      2018-11-29 [1] CRAN (R 3.6.0)                      
 viridisLite    0.3.0      2018-02-01 [1] CRAN (R 3.6.0)                      
 whisker        0.3-2      2013-04-28 [1] CRAN (R 3.6.0)                      
 withr          2.1.2      2018-03-15 [1] CRAN (R 3.6.0)                      
 xfun           0.6        2019-04-02 [1] CRAN (R 3.5.3)                      
 xml2           1.2.0      2018-01-24 [1] CRAN (R 3.6.0)                      
 xtable         1.8-4      2019-04-21 [1] CRAN (R 3.6.0)                      
 xts            0.11-2     2018-11-05 [1] CRAN (R 3.6.0)                      
 yaml           2.2.0      2018-07-25 [1] CRAN (R 3.6.0)                      
 zeallot        0.1.0      2018-01-28 [1] CRAN (R 3.6.0)                      
 zoo          * 1.8-5      2019-03-21 [1] CRAN (R 3.6.0)                      

[1] E:/R library
[2] E:/R-3.6.0/library

    warnings 应该不是关键。你的shiny版本到了 1.3.2 ,建议加入 options(shiny.reactlog = TRUE) 开启调试模式看看是哪里出的问题。

    • Hoas 回复了此帖

      Hoas
      方便看一下 log 吗? 或者把 LOCAL_APPDATA_FONTCONFIG_CACHE 等历史遗留文件清理了,然后再重新部署一次?

      • Hoas 回复了此帖

        yufree
        调试之后依旧无报错……只有弹出的网站上的首行 Error。

        Jiena
        您说的 log 是这个吗?

        Preparing to deploy application...DONE
        Uploading bundle for application: 946740...DONE
        Deploying bundle: 2105386 for application: 946740 ...
        Waiting for task: 616391895
          building: Parsing manifest
          building: Building image: 2219478
          building: Installing system dependencies
          building: Installing packages
          building: Installing files
          building: Pushing image: 2219478
          rollforward: Activating new instances
          success: Stopping old instances
        Application successfully deployed to https://hoas.shinyapps.io/xaj_model/
        Deployment completed: https://hoas.shinyapps.io/xaj_model/

        以及那个LOCAL_APPDATA_FONTCONFIG_CACHE我不清楚是啥,是RunApp旁边的 Clear List 吗?

        yihui
        去掉这个 options 在 RStudio 中就再无报错,但是网站上还是那样……


        现在才知道 log 是这个...

        ----- Deployment log started at  2019-05-24 10:50:39  -----
        Deploy command: 
         rsconnect::deployApp(appDir = "E:/1R/xaj_model", appFileManifest = "C:/Users/Hoas/AppData/Local/Temp/06ed-90b8-961d-3f95",      account = "hoas", server = "shinyapps.io", appName = "xaj_model",      appTitle = "xaj_model", launch.browser = function(url) {         message("Deployment completed: ", url)     }, lint = FALSE, metadata = list(asMultiple = FALSE, asStatic = FALSE,          ignoredFiles = "global.R|xunhe.csv|xunhe.txt|xunhe.xlsx"),      logLevel = "verbose") 
        
        Session information: 
        R version 3.6.0 (2019-04-26)
        Platform: x86_64-w64-mingw32/x64 (64-bit)
        Running under: Windows 10 x64 (build 17134)
        
        Matrix products: default
        
        locale:
        [1] LC_COLLATE=Chinese (Simplified)_China.936 
        [2] LC_CTYPE=Chinese (Simplified)_China.936   
        [3] LC_MONETARY=Chinese (Simplified)_China.936
        [4] LC_NUMERIC=C                              
        [5] LC_TIME=Chinese (Simplified)_China.936    
        
        attached base packages:
        [1] stats     graphics  grDevices utils     datasets  methods   base     
        
        loaded via a namespace (and not attached):
        [1] compiler_3.6.0   rsconnect_0.8.13
        Cookies: 
        [1] "None"
        GET /v1/applications/946748 2070ms
        ----- Deployment error -----
        ����: HTTP 404
        GET https://api.shinyapps.io/v1/applications/946748
        Not Found
         
        ----- Error stack trace -----
        8: stop("HTTP ", response$status, "\n", response$req$method, " ", 
               response$req$protocol, "://", response$req$host, response$req$port, 
               response$req$path, "\n", msg, call. = FALSE)
        7: reportError(json$error)
        6: handleResponse(GET(service, authInfo, path))
        5: client$getApplication(target$appId)
        4: applicationForTarget(client, accountDetails, target, forceUpdate)
        3: force(code)
        2: withStatus(paste0("Preparing to deploy ", assetTypeName), {
               application <- applicationForTarget(client, accountDetails, 
                   target, forceUpdate)
           })
        1: rsconnect::deployApp(appDir = "E:/1R/xaj_model", appFileManifest = "C:/Users/Hoas/AppData/Local/Temp/06ed-90b8-961d-3f95", 
               account = "hoas", server = "shinyapps.io", appName = "xaj_model", 
               appTitle = "xaj_model", launch.browser = function(url) {
                   message("Deployment completed: ", url)
               }, lint = FALSE, metadata = list(asMultiple = FALSE, asStatic = FALSE, 
                   ignoredFiles = "global.R|xunhe.csv|xunhe.txt|xunhe.xlsx"), 
               logLevel = "verbose")
        ����: HTTP 404
        GET https://api.shinyapps.io/v1/applications/946748
        Not Found
        ִֹͣ��

        失败 N 连后终于解决了,解决方式也太奇葩了:

        HTTP 404
        GET https://api.shinyapps.io/v1/applications/946748
        Not Found

        出现如此报错之后,我 restart,reconnect ……我想试试在本地有无问题,结果就只是加载了需要的一些包,然后再部署问题就解决了。

        Hoas 更改标题为「【已解决】shiny 部署失败,失败
        5 年 后
        9 天 后

        AgnesZhang 好久之前的了,我现在也好久没用了,忘了是哪些包。