I am developing an R package, which during development, I am distributing among colleagues with tarballs. Some of them are unable to install the package because of such an error:
> install.packages("~/Desktop/package.tar.gz", repos = NULL, type = "source")
* installing *source* package ‘package’ ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
No man pages found in package ‘package’
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
ERROR: hard-coded installation path: please report to the package maintainer and use ‘--no-staged-install’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/package’
Warning in install.packages :
installation of package ‘/Users/name/Desktop/package.tar.gz’ had non-zero exit status
The error tells us, that installation fails because of the hard-coded installation path. The thing is that I don't have installation path coded anywhere in the package (I use system.path() couple of times).
I am able to do the installation by running the command R CMD INSTALL package.tar.gz --no-staged-install all but this is not the desired installation method.
It is possible R CMD check is giving you a false positive, but we unfortunately can't know for sure unless you can provide the source to your package somewhere we can look at it, e.g. on GitHub or similar hosting services.
I saw someone ask about the same error message with a package available on github (https://github.com/kevinwolz/hisafer/). I'm guessing this path check is new in 3.6? Do you know of any way of finding where in the package this path might be? Or get the check to print out the bad path so it's easier to find?