新工作笔记本RStudio安装GitHub包失败:..rs.invokeShinyWindowExternal未找到
解决RStudio安装GitHub包时
..rs.invokeShinyWindowExternal未找到的错误 问题背景
在工作笔记本的RStudio中执行devtools::install_github("dustinfife/flexplot")安装包时,触发错误:
Error: Object '..rs.invokeShinyWindowExternal' not found Execution stopped
已尝试cmd环境安装、本地包手动安装、获取管理员权限等方式,问题仍未解决。
针对性解决方案
禁用RStudio的Shiny外部浏览器调用
打开RStudio全局选项(Tools → Global Options),切换到「Shiny」标签页,取消勾选「Use external browser for Shiny applications」,重启RStudio后再次尝试安装;或在控制台先运行options(shiny.launch.browser = FALSE),再执行安装命令。用remotes替代devtools安装
remotes是devtools的核心依赖,更少绑定RStudio特定功能,执行以下命令:install.packages("remotes") remotes::install_github("dustinfife/flexplot", dependencies = TRUE)在纯R环境中强制安装
脱离RStudio,打开系统自带的纯R终端,运行:install.packages("remotes") remotes::install_github("dustinfife/flexplot", dependencies = TRUE, quiet = TRUE)若仍有权限问题,指定个人库路径规避系统库限制:
dir.create(Sys.getenv("R_LIBS_USER"), recursive = TRUE) remotes::install_github("dustinfife/flexplot", lib = Sys.getenv("R_LIBS_USER"), dependencies = TRUE)本地安装时添加架构参数
手动下载包的tar.gz文件,执行本地安装时加上--no-multiarch参数,避免企业环境下的架构权限限制:install.packages("本地文件路径/flexplot.tar.gz", repos = NULL, type = "source", INSTALL_opts = "--no-multiarch")
内容的提问来源于stack exchange,提问作者Anton Schreiber antonskrywer




