Interact with yarn from the R console.
# install.packages("remotes")
remotes::install_github("JohnCoene/yarn")
library(yarn)
# installs yarn itself globally
install_yarn()
yarn_init()
yarn_add("browserify", scope = "global")
yarn_run("--version")
See also npm.