首页 > 解决方案 > 错误:找不到以“^Package”开头的根“DESCRIPTION”文件

问题描述

我正在用 golem 开发一个闪亮的应用程序。在我的电脑上一切正常,但后来我在 github 上加载了包并安装在另一台电脑上。该应用程序有两个主要部分:第一部分您可以处理原始数据并将输出保存为.rds文件,第二部分您可以分析详细数据(您也可以上传.rds已处理的文件)。问题出在第一部分,当我必须读取多个文件时。它给了我这个错误:

Error in: Could not find a root 'DESCRIPTION' file that starts with '^Package' in 'C:\Users\Della Rocca\Documents'. 
Are you in your project directory, and does your project have a 'DESCRIPTION' file?

我可以复制出现问题的服务器部分:

  # this makes the directory at the base of your computer.
  volumes = c(Home = fs::path_home(), shinyFiles::getVolumes()()) 
  
  
  ####select the data folder where to read data
  shinyFiles::shinyDirChoose(input, 'datafolder', roots = volumes, session = session)
  
  data_path = reactive({
    if(length(input$datafolder) != 1 ) {
      shinyFiles::parseDirPath(volumes,input$datafolder)
    }else{
      NULL
    }
  })
  

  stepb = eventReactive(input$readdatabttn,{
    req(data_path(), targets(), analysis())
    
    stepa = list(targets = targets(), analysis = analysis())
    withProgress(message = "Reading data...", value=0, {

      #external function that takes the path and reads multiple .txt files catching names from the target_file (a .xlsx file)
      read_advise_lipidomics(out = stepa, datapath = data_path(), target_file = stepa$targets$targetfile_lipidomics)
    })
    
  })

data_path()没关系,因为它有正确的路径。问题是当我eventReactive()用按钮触发时input$readdatabttn

你知道那个错误是什么吗?我有描述文件并且正在运行devtools::check()我没有错误,只是一个警告:

> checking Rd \usage sections ... WARNING
  Undocumented arguments in documentation object 'calibplot_advise_lipidomics'
    'plot_calibration'
  
  Undocumented arguments in documentation object 'create_beautiful_radarchart'
    'vlabels' 'title' '...'
  
  Undocumented arguments in documentation object 'na_advise_lipidomics'
    'na_filter_lip' 'na_filter_sam' 'imputation_met' 'imputation_val'
  
  Undocumented arguments in documentation object 'read_advise_lipidomics'
    'datapath'
  
  Undocumented arguments in documentation object 'recovery_advise_lipidomics'
    'intercept_flag'
  
  Functions with \usage entries need to have the appropriate \alias
  entries, and all their arguments documented.
  The \usage entries must correspond to syntactically valid R code.
  See chapter 'Writing R documentation files' in the 'Writing R
  Extensions' manual.

标签: rshinygolem

解决方案


我解决了。问题是在代码中我获取包版本并将其保存在一个变量中。我使用了该功能golem::get_golem_version(),并且该功能仅在我的开发项目目录中有效,在所有其他项目中(即使在同一台计算机上)都不起作用。现在我自己编写版本,但我想自动化它。

编辑:我 packageVersion()在里面使用了我的包名,现在它可以工作了。


推荐阅读