installing source package ‘fansi’ ...
** package ‘fansi’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
make: *** No rule to make target 'assumptions.o', needed by 'fansi.so'. Stop.
*** arch - r-4.1.3_1_amd64.deb
Warning in file(con, "r") :
cannot open file '/opt/R/4.2.1/lib/R/etc/r-4.1.3_1_amd64.deb/Makeconf': No such file or directory
Error in file(con, "r") : cannot open the connection
removing ‘/opt/R/4.2.1/lib/R/library/fansi’
For some reason it is looking for file /opt/R/4.2.1/lib/R/etc/r-4.1.3_1_amd64.deb/Makeconf when compiling.
I just gave this a go and unfortunately I am failing to reproduce this issue.
My best guess at the moment is there must be something either environment or user specific wrong in your setup.
User Specific:
Can you please try the package installation under a different user account ? If it works under a different user, you are likely to have settings in .Rprofile or .Renviron in the affected users home-directory (either in the base folder of the home-directory - e.g. /home/username - or in the current working directory where you are trying to install the package from)
Another source of the issue described above could be in .R/Makevars in your home-directory.
Environment specific:
Did you do any modification to the R installation after you deployed R 4.2.1 as deb package ?
Does the R package installation work if you run R directly on the command line outside of any RStudio product or any other IDE ?
Thanks for the tips Michael. These issues were on an AWS EC2 instance, so I was running as root and running R on the command line. I didn't have anything set with .Renviron, .Rprofile, or .R/Makevars.
I was able to resolve the problem by completely removing the /opt/R/4.2.1 directory and trying again:
# Clear out /opt/R/4.2.1
rm -rf /opt/R/4.2.1
# Install again
export R_VERSION=4.2.1
curl -O https://cdn.rstudio.com/r/ubuntu-2004/pkgs/r-${R_VERSION}_1_amd64.deb
sudo gdebi --n r-${R_VERSION}_1_amd64.deb
Then I started R with /opt/R/4.2.1/bin/R (as before) and then install.packages('dplyr') worked as expected.
I'm not sure what caused the original issue, since and I didn't make any changes to the files in the /opt/R/4.2.1 directory, but deleting all of the files and re-installing took care of it!