Causes of "Error: package '_____' was built before 3.0.0: please re-install it" in R

I found this solution while look at GitHub ggplot2 issue #796

update.packages(checkBuilt = TRUE, ask = FALSE)

It will update all the packages that need to be reinstalled.


Running install.packages("codetools") can fix this issue for R 3.0.2, if you have the same problem like me:

installing to /home/user/R/x86_64-pc-linux-gnu-library/3.0/Rcpp/libs
** R
** inst
** preparing package for lazy loading
Error : package ‘**codetools**’ was built before R 3.0.0: please re-install it
Error : unable to load R code in package ‘Rcpp’
ERROR: lazy loading failed for package ‘Rcpp’

I installed shiny according https://github.com/rstudio/shiny-server/wiki/Ubuntu-step-by-step-install-instructions

and got the same error at the step

sudo su - -c "R -e \"install.packages('shiny', repos='http://cran.rstudio.com/')\""

Warning messages:
1: In install.packages("shiny", repos = "http://cran.rstudio.com/") :
 installation of package ‘Rcpp’ had non-zero exit status
2: In install.packages("shiny", repos = "http://cran.rstudio.com/") :
 installation of package ‘httpuv’ had non-zero exit status
3: In install.packages("shiny", repos = "http://cran.rstudio.com/") :
 installation of package ‘shiny’ had non-zero exit status

I tried the answer by Richard Lee by starting R

R

and got the error

Warning in install.packages("shiny") :
'lib = "/usr/local/lib/R/site-library"' is not writable
Would you like to use a personal library instead?  (y/n) n
Error in install.packages("shiny") : unable to install packages

obviously no write permission, so

sudo R

Now I tried again

install.packages("shiny")

and got a number of errors

Error : package ‘codetools’ was built before R 3.0.0: please re-install it
Error : package ‘RJSONIO’ was built before R 3.0.0: please re-install it
Error : package ‘caTools’ was built before R 3.0.0: please re-install it
Error : package ‘bitops’ was built before R 3.0.0: please re-install it
Error : package ‘digest’ was built before R 3.0.0: please re-install it
Error : package ‘xtable’ was built before R 3.0.0: please re-install it

Each time I got an error, I re-installed the requested package

install.packages("codetools")
install.packages("RJSONIO")
etc.

and eventually, I was able to install Rccp, httpuv, and even shiny. Now it works!!

Also see Shiny package installation on R version 3.0.2 "Frisbee Sailing"