错误:path [1] =“”:使用shinyapps

时间:2015-12-25 15:08:01

标签: r rstudio rcharts shiny

我正在尝试使用rCharts Highcharts向shinyapps发布一个webapp,我收到以下错误

ERROR: path[1]="": No such file or directory

但奇怪的是,在测试时,webapp在我的笔记本电脑上无效地工作。

我环顾四周,似乎是唯一有问题的人。我找不到任何参考。

我尝试使用测试应用程序重建错误。我可以做的更简单的例子如下。

Ui.R如下

library(shiny)
library(rCharts)
shinyUI(fluidPage(
  titlePanel("Subset mtcars data"),
  sidebarLayout(
    sidebarPanel(
      checkboxGroupInput("features",
                         label = h3("Features to display"),
                         choices = list("disp" = 1, "hp" = 2),
                         selected = c(1,2) ),
      checkboxGroupInput("cars",
                         label = h3("Cars to display"),
                         choices = list("Mazda RX4" = "Mazda RX4",
                                        "Mazda RX4 Wag" = "Mazda RX4 Wag",
                                        "Datsun 710" = "Datsun 710",
                                        "Hornet 4 Drive" = "Hornet 4 Drive",
                                        "Hornet Sportabout" =  "Hornet Sportabout",
                                        "Valiant" = "Valiant"),
                         selected = c("Mazda RX4","Mazda RX4 Wag","Datsun 710",
                                      "Hornet 4 Drive","Hornet Sportabout","Valiant") ) ),
    mainPanel(
      showOutput("barChart", "Highcharts")
    ) ) ) )

server.R是

library(shiny)
library(rCharts)
data= head(mtcars)[,c("disp", "hp")]
shinyServer(function(input, output) {
  output$barChart <- renderChart2( { 
    # column selection
    if (!(1 %in% input$features)) { data$disp=NULL }
    if (!(2 %in% input$features)) { data$hp=NULL }
    # rows selection
    data= data[input$cars,]
    # chart
    barChart.chart <- Highcharts$new()
    barChart.chart$chart(type = "column")
    barChart.chart$title(text = "Subset mtcars data")
    barChart.chart$xAxis(categories = rownames(data))
    barChart.chart$yAxis(title = list(text = "Number of Refugees"))
    barChart.chart$data(data)
    barChart.chart$legend(symbolWidth = 80)
    return(barChart.chart) } ) } )

该应用程序在本地环境中运行良好,但在推送到shinyApps.io时失败。这是我的程序和我得到的消息:

> deployApp(appName = "PathFault",lint = TRUE) # Lint should be TRUE by default but I force it anyway
Preparing to deploy application...DONE
Uploading bundle for application: 75795...
Detecting system locale ... de_DE
DONE
Deploying bundle: 340000 for application: 75795 ...
Waiting for task: 121937348
  building: Parsing manifest
  building: Installing packages
  building: Installing files
  building: Pushing image: 334046
  deploying: Starting instances
  rollforward: Activating new instances
  unstaging: Stopping old instances
Application successfully deployed to https://legru.shinyapps.io/PathFault
> 

但打开https://legru.shinyapps.io/PathFault会显示错误。

日志显示以下内容:

> showLogs(appName = "PathFault")
2015-12-28T07:05:54.597553+00:00 shinyapps[75795]: R version: 3.2.3
2015-12-28T07:05:54.597645+00:00 shinyapps[75795]: shiny version: 0.12.2
2015-12-28T07:05:54.597646+00:00 shinyapps[75795]: rmarkdown version: NA
2015-12-28T07:05:54.597647+00:00 shinyapps[75795]: knitr version: NA
2015-12-28T07:05:54.597648+00:00 shinyapps[75795]: jsonlite version: 0.9.19
2015-12-28T07:05:54.597661+00:00 shinyapps[75795]: RJSONIO version: 1.3.0
2015-12-28T07:05:54.597662+00:00 shinyapps[75795]: htmltools version: 0.2.6
2015-12-28T07:05:54.808343+00:00 shinyapps[75795]: Using jsonlite for JSON                         processing
2015-12-28T07:05:54.811938+00:00 shinyapps[75795]: 
2015-12-28T07:05:54.811940+00:00 shinyapps[75795]: Starting R with process     ID: '11'
2015-12-28T07:05:54.816505+00:00 shinyapps[75795]: 
2015-12-28T07:05:54.816508+00:00 shinyapps[75795]: Listening on     http://0.0.0.0:57737
2015-12-28T07:06:00.971541+00:00 shinyapps[75795]: R version: 3.2.3
2015-12-28T07:06:00.971671+00:00 shinyapps[75795]: shiny version: 0.12.2
2015-12-28T07:06:00.971673+00:00 shinyapps[75795]: rmarkdown version: NA
2015-12-28T07:06:00.971675+00:00 shinyapps[75795]: knitr version: NA
2015-12-28T07:06:00.971701+00:00 shinyapps[75795]: jsonlite version: 0.9.19
2015-12-28T07:06:00.971703+00:00 shinyapps[75795]: RJSONIO version: 1.3.0    
2015-12-28T07:06:00.971718+00:00 shinyapps[75795]: htmltools version: 0.2.6
2015-12-28T07:06:01.172811+00:00 shinyapps[75795]: Using jsonlite for JSON     processing
2015-12-28T07:06:01.176769+00:00 shinyapps[75795]: 
2015-12-28T07:06:01.176771+00:00 shinyapps[75795]: Starting R with process     ID: '26'
2015-12-28T07:06:01.181306+00:00 shinyapps[75795]: Listening on     http://0.0.0.0:54220
2015-12-28T07:06:01.181304+00:00 shinyapps[75795]: 
2015-12-28T07:06:01.342999+00:00 shinyapps[75795]: Error in     normalizePath(directoryPath, mustWork = TRUE) : 
2015-12-28T07:06:01.343004+00:00 shinyapps[75795]:   path[1]="": No such     file or directory

在我的测试中,我验证了如果我注释掉“showOutput(”barChart“,”Highcharts“)”在ui.R中没有错误(但没有图表;-()。这似乎是Highcharts的问题和shinyapps。

我的环境:

我正在使用Windows 10

  

R.version                  _
  平台x86_64-w64-mingw32
  拱x86_64
  os mingw32
  system x86_64,mingw32
  状态
  专业3   未成年人2.3
  2015年   12月11日   第10天   svn rev 69752
  语言R
  version.string R版本3.2.3(2015-12-10)   昵称木制圣诞树

闪亮版:0.12.2 rCharts版本:0.45

我使用RStudio版本0.99.489

公开该应用程序

我希望有人可以提供帮助

1 个答案:

答案 0 :(得分:1)

“Highcharts”中的“h”必须小写:

showOutput("barChart", "highcharts")

如果这不起作用:对于部署,showOutput需要您详细说明highcharts-lilbrary的路径(至少在我的情况下,无论出于何种原因^^)。

我遇到的问题与你的问题非常相似。这是我的解决方案: "ERROR: path[1]="": No such file or directory" when publishing Parallel Coordinates Chart with Shiny