R build软件包在zip上失败

R build软件包在zip上失败

问题描述:

我正在尝试构建软件包,并且软件包生成失败并显示以下错误:

I am trying to build a package and the package generation fails with the error:

Warning: running command '"zip" -r9Xq "C:/path/package_name_version.zip" 
SEERtools' had status 127 running 'zip' failed

该软件包已成功构建,但是缺少二进制文件.

The package is built successfully, but the binary is missing.

构建日志:

> devtools::build(binary = TRUE,path=".")
"C:/Rpath/R-32~1.3/bin/x64/R" --no-site-file --no-environ --no-save --no-restore CMD INSTALL  \
  "C:\path" --build 

* installing to library 'C:/Libpath/library'
* installing *source* package 'package_name' ...
** R
** data
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
*** arch - i386
*** arch - x64
* MD5 sums
Warning: running command '"zip" -r9Xq "C:/path/package_name_version.zip" package_name' had status 127
running 'zip' failed
* DONE (package_name)
[1] "./package_name_version.zip"

该错误消息没有给出在哪里寻找的线索.我试过了:

The error message doesn't give a clue where to look. I tried:

  • 设置文件夹的读/写文件
  • 将文件夹移动到另一个文件夹

问题与创建zip文件不同:错误运行命令"状态为127 ,因为问题出在zip程序上.在这种情况下,zip函数仍然可以按预期方式(单独)运行,但是build函数中的特定zip命令失败.

The problem is not the same as Create zip file: error running command " " had status 127 since there the problem lies in the zip procedure. In this case the zip function still behaves as expected (separately), but the specific zip command in the build function fails.

我发现的最佳答案是在构建参数中添加"--preclean".

The best answer I found was adding '--preclean' to the build arguments.

>devtools::build(binary = TRUE,path=".", args = c('--preclean'))

根据文档,此操作仅清除以前版本中的文件,但确实解决了错误消息.

According to the documentation this only cleans the files from a previous build, but it does solve the error message.