r-lib / pak

A fresh approach to package installation
https://pak.r-lib.org
671 stars 60 forks source link

package installation fails if 'pak' loaded but not on library paths #486

Open kevinushey opened 1 year ago

kevinushey commented 1 year ago

For example:

> library(pak)
> .libPaths(tempdir())
> pak::pkg_install("rlang")
Error: 
! error in pak subprocess
Caused by error in `loadNamespace(name)`:
! there is no package called ‘pak’
Type .Last.error to see the more details.
> packageVersion("pak")
[1] '0.5.0.9000'

The issue goes away if I force the remote to be initialized before setting the library paths, e.g.

library(pak)
pak:::remote(identity, list(x = 42))
.libPaths(tempdir())
pak::pkg_install("rlang")