Why shows Error: 'makevars_user' is not an exported object from 'namespace:withr'

I was wondering why after I installed the ‘rstan’ package and when I run

stan_model() in R it shows

“Error: ‘makevars_user’ is not an exported object from ‘namespace:withr’
In addition: Warning message:
In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
‘-E’ not found”

anyone has any ideas about this??

That’s a strange error since makevars_user is definitely an exported function in the withr package. But maybe it wasn’t in a previous version of withr. Which version of the withr package do you have? If it’s not the most recent maybe updating that will fix this.

@stevebronder @bgoodri this must be related to recently adding the withr stuff. If there is a minimal withr version number required we need to put that in RStan’s DESCRIPTION file so it gets installed.

Yes, that was added for withr 2.2.0: https://github.com/r-lib/withr/commit/a7eea124adfc7cf7eea3b0c11c17846b535fc2d5#diff-7347fe5a0f184f79ef064e92e3beb297

1 Like

So, I guess I need to add a versioning requirement on withr.


I followed all the steps on “Rstan Getting Started”, including the configuration of the C++ Toolchain, but I end up with the exact same Error Problem ("‘makevars_user’ is not an exported object from ‘namespace:withr’").

Is there any way to deal with it ?


Try upgrading the withr packages with


It should be 2.2.0