URGENT problems with Rstan install

To whom it may concern,
I upgraded Rvrsion to 4.2 and stan stopped working. Since I read it could be a problem with R4.2 I uninstalled everything and began again with R.4.0. I am srtuggling with Rtools installation I have followed


for R.4.0
everything seems to work fine with the path, but when I try to download
install.packages(“jsonlite”, type = “source”) as a final test
it does not get installed with the following message

gcc -I"C:/PROGRA~1/R/R-44~1.0/include" -DNDEBUG -Iyajl/api -I"c:/rtools44/x86_64-w64-mingw32.static.posix/include" -D__USE_MINGW_ANSI_STDIO -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c base64.c -o base64.o
sh: line 1: gcc: command not found
make: *** [C:/PROGRA~1/R/R-44~1.0/etc/x64/Makeconf:289: base64.o] Error 127
ERROR: compilation failed for package ‘jsonlite’

  • removing ‘C:/Users/usuario/AppData/Local/R/win-library/4.4/jsonlite’
  • restoring previous ‘C:/Users/usuario/AppData/Local/R/win-library/4.4/jsonlite’
    Warning in install.packages :
    installation of package ‘jsonlite’ had non-zero exit status

I also tried the example(stan_model, package = “rstan”, run.dontrun = TRUE)
it asked me to install rtools44, which I did and provided me the following error
Error en compileCode(f, code, language = language, verbose = verbose):
sh: line 1: g++: command not foundmake: *** [C:/PROGRA~1/R/R-44~1.0/etc/x64/Makeconf:296: file36105068bca.o] Error 127

I have been reading forums and trying different things and cannot fix it. I have tried to find and delet the REnviron file in the document folder and this has not worked, among others.

Please could you help me? I am going to a conference in July and all my models are programmed in stan, I am anxious that I won’t be able to make it work again…

Kind regards
Tere Morán

just wondering, did you also upgrade the Rtools for your new version of R?

Yes I had. At the end I solved it following Rstan installation troubles
It was a problem of the paths in my computer were not ereased with the code in R.