Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R build package fails on zip

Tags:

package

r

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.

Build log:

> 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:

  • Setting the read/write files for the folder
  • Moved the folder to another folder

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.

like image 220
takje Avatar asked Feb 08 '23 03:02

takje


1 Answers

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.

like image 159
takje Avatar answered Feb 16 '23 04:02

takje