posit-dev / publisher

MIT License
4 stars 0 forks source link

R Scan fails on Windows #1746

Closed kgartland-rstudio closed 4 months ago

kgartland-rstudio commented 4 months ago

When hitting the Scan for R packages with or without an existing renv.lock file in Windows, we fail with:

An error has occurred at homeView::_onScanForRPackageRequirements, Code=ERR_BAD_RESPONSE, Msg=Request failed with status code 500, URL=http://localhost:61514/api/post/packages/r/scan

Logs:

time=2024-05-29T14:25:10.674-04:00 level=DEBUG msg="Running command" cmd="C:\Program Files (x86)\R\R-4.4.0\bin\R.exe" args=--version time=2024-05-29T14:25:10.792-04:00 level=INFO msg="Creating renv lockfile" path=c:\Users\kgartland\publisher-client\bundles\mpg-shinyApp\renv.lock r="C:\Program Files (x86)\R\R-4.4.0\bin\R.exe" time=2024-05-29T14:25:10.792-04:00 level=DEBUG msg="Running command" cmd="C:\Program Files (x86)\R\R-4.4.0\bin\R.exe" args="-s -e renv::snapshot(lockfile=\"c:\Users\kgartland\publisher-client\bundles\mpg-shinyApp\renv.lock\")" time=2024-05-29T14:25:11.409-04:00 level=ERROR msg="Error running command" command="C:\Program Files (x86)\R\R-4.4.0\bin\R.exe" error="exit status 1" Error: '\U' used without hex digits in character string (:1:29) Execution halted time=2024-05-29T14:25:11.409-04:00 level=DEBUG msg=renv::snapshot() out="- The project is out-of-sync -- use renv::status() for details.\r\n" err="Error: '\U' used without hex digits in character string (:1:29)\r\nExecution halted\r\n" time=2024-05-29T14:25:11.409-04:00 level=ERROR msg="Internal Server Error" method=POST url=/api/packages/r/scan error="exit status 1" time=2024-05-29T14:25:11.409-04:00 level=INFO msg="Access Log" method=POST url=/api/packages/r/scan elapsed_ms=738 status=500 req_size=24 resp_size=21 client_addr=127.0.0.1:62384 req.saveName=renv.lock

kgartland-rstudio commented 4 months ago

I realized that the original error may have been an issue with my environment given the The project is out-of-sync message so I fixed that up and ran it again and hit the same error here:

err="Error: '\\U' used without hex digits in character string (<input>:1:29)\r\nExecution halted\r\n"

Full log:

time=2024-05-29T15:18:52.899-04:00 level=DEBUG msg="Running command" cmd="C:\Program Files (x86)\R\R-4.4.0\bin\R.exe" args=--version time=2024-05-29T15:18:53.025-04:00 level=INFO msg="Creating renv lockfile" path=c:\Users\kgartland\publisher-client\bundles\mpg-shinyApp\renv.lock r="C:\Program Files (x86)\R\R-4.4.0\bin\R.exe" time=2024-05-29T15:18:53.025-04:00 level=DEBUG msg="Running command" cmd="C:\Program Files (x86)\R\R-4.4.0\bin\R.exe" args="-s -e renv::snapshot(lockfile=\"c:\Users\kgartland\publisher-client\bundles\mpg-shinyApp\renv.lock\")" time=2024-05-29T15:18:54.634-04:00 level=ERROR msg="Error running command" command="C:\Program Files (x86)\R\R-4.4.0\bin\R.exe" error="exit status 1" Error: '\U' used without hex digits in character string (:1:29) Execution halted time=2024-05-29T15:18:54.634-04:00 level=DEBUG msg=renv::snapshot() out="" err="Error: '\U' used without hex digits in character string (:1:29)\r\nExecution halted\r\n" time=2024-05-29T15:18:54.634-04:00 level=ERROR msg="Internal Server Error" method=POST url=/api/packages/r/scan error="exit status 1" time=2024-05-29T15:18:54.634-04:00 level=INFO msg="Access Log" method=POST url=/api/packages/r/scan elapsed_ms=1739 status=500 req_size=24 resp_size=21 client_addr=127.0.0.1:63150 req.saveName=renv.lock

kgartland-rstudio commented 4 months ago

I was able to reproduce this at the terminal in Windows, running:

> R.exe -s -e 'renv::snapshot(lockfile=\"c:\Users\kgartland\publisher-client\bundles\mpg-shinyApp\renv.lock")'
Error: '\U' used without hex digits in character string (<input>:1:29)
Execution halted

When I escaped the \ it worked:

> R.exe -s -e 'renv::snapshot(lockfile=\"c:\\Users\\kgartland\\publisher-client\\bundles\\mpg-shinyApp\\renv.lock\")'
The following package(s) will be updated in the lockfile:...