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.
The best answer I found was adding '--preclean' to the build arguments.
According to the documentation this only cleans the files from a previous build, but it does solve the error message.
I got this error because I forgot to install RTools as required by devtools on Windows. Once I installed it and restarted RStudio, it worked.
I am responding to provide an updated solution to this issue I have found older responses to here and elsewhere on SO. I am using Windows 10, R version 3.4.3, RTools version 3.4.
Previous answers suggested editing environmental variables by going to:
to include "C:/RTools/bin".
I had to add a new path that instead reads "C:/RBuildTools/3.4/bin". It is then necessary to reboot at least R, but I went ahead and restarted my computer. To make sure the Path in R is updated, open a new R session, type
Sys.getenv()
and make sure that "C:/RBuildTools/3.4/bin" is there. I was then able to successfully zip my R package.